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

BsonDiscriminator not always written

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Unknown 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.

      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.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            msimkin@bn.com Marc Simkin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: