3.5.0 Discriminator breaking changes (Cannot map "_t" to Class Property any more)

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.5.0
    • Component/s: None
    • None
    • 🔵 Done
    • Dotnet Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Hi,

      We’ve mapped the "_t" field to a class property in our model. However, it seems that version 3.5.0 of the MongoDB C# driver does not allow this.

      Is there any workaround for this limitation? We’d like to avoid introducing an additional property or performing major code refactoring if possible.

      Thanks!

       

      How to Reproduce

              [BsonElement("_t")]
              public string EnvironmentType { get; set; } 

       

      Additional Background

      MongoDB Atlas 8.0

            Assignee:
            Ferdinando Papale
            Reporter:
            Dimitri Kroo
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: