[CSHARP-238] When serializing a class with a property that is a Dictionary where the keys are not strings the keys are serialized with a redundant "_t" element Created: 02/Jun/11  Updated: 02/Apr/15  Resolved: 02/Jun/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.0
Fix Version/s: 1.1

Type: Bug Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

For example, an instance of this class:

public class Point

{ public int X; public int Y; }

public class C

{ public ObjectId Id; public Dictionary<Point, int> Points; }

is serialized as:

> db.test.find()
{ "_id" : ObjectId("4de7fc1fe447ad107cce92da"), "Points" : [
[

{ "_t" : "Point", "X" : 1, "Y" : 1 }

,
1
],
[

{ "_t" : "Point", "X" : 2, "Y" : 2 }

,
2
]
] }
>

But the "_t" values are redundant because the type of the key is known to be Point.



 Comments   
Comment by Robert Stam [ 02/Jun/11 ]

Fixed.

Generated at Wed Feb 07 21:36:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.