Details
-
Bug
-
Resolution: Unresolved
-
Unknown
-
None
-
2.14.1, 2.13.3
-
None
-
None
Description
Summary
When using FindOneAndUpdate(Async) with Upsert = true and only SetOnInsert fields, BsonDiscriminator is not written.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Driver 2.13.3 and 2.14.1, .NET 6
Sharded Clusters 3.4.10 and 3.4.16
Standalone: 5.0.5
How to Reproduce
See attached Zip.
- Create a Class.
- Create a ClassMap. ClassMap should set discriminator name, required, root, and add known type. (see file BasicLockBlock.cs in attached Zip.)
- Register ClassMap.
- Execute FindAndUpdate(Async) for a document that doesn't exist. Use Upsert = true to insert new document. (see file program.cs in attached Zip.)
Additional Background
Please provide any additional background information that may be helpful in diagnosing the bug.