-
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.