BsonDiscriminator not always written

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: 2.14.1, 2.13.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

      1. Create a Class.
      2. Create a ClassMap. ClassMap should set discriminator name, required, root, and add known type. (see file BasicLockBlock.cs in attached Zip.)
      3. Register ClassMap.
      4. 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.

            Assignee:
            Robert Stam (Inactive)
            Reporter:
            Marc Simkin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: