Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. 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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1
    • Affects Version/s: 1.0
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: