BsonObjectId type serializes as a discriminated type

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.2.3
    • Component/s: BSON, Serialization
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

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

              Created:
              Updated:
              Resolved: