Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1590

BsonObjectId type serializes as a discriminated type

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.2.3
    • BSON, Serialization
    • None

    Description

      When a BsonObjectId is stored in a field of type object, it is serialized as a discriminated type, rather than as an ObjectId type. The field is serialized with the ObjectSerializer, which does not check for the BsonObjectId type (or any other BsonValue type). One would intuitively expect BsonValue types to serialize to the corresponding BSON values, rather than as a discriminated type.

      This can be reproduced by deserializing an ObjectId to a field of type object and then reserializing it to BSON. The result is a discriminated type document.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jpeebles Julianna Peebles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: