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

Discriminator is lost when using ObjectUpdateDefinition<T>

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • Labels:

      Summary

      When updating a document with polymorphic type TDocument and known sub type TSubType using an ObjectUpdateDefinition the type discriminator is lost.

      Version: C# Driver: 2.17.1

      How to Reproduce

      • Use FindOneAndUpdateAsync on a document with polymorphic type using an _ObjectUpdateDefinition_

      Additional Background

      The Render method of ObjectUpdateDefinition<T> resolved the serializer from the type of the object but ignores the documentSerializer which should be used. Thus, the serializer of the TSubType is picked which does not add the type discriminator.

            Assignee:
            Unassigned Unassigned
            Reporter:
            martin.pluecker@algominds.de Martin Plücker
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: