Discriminator is lost when using ObjectUpdateDefinition<T>

XMLWordPrintableJSON

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

      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
              Reporter:
              Martin Plücker
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: