Querying polymorphic type causes NotSupportedException

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • 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

      After upgrade from C# Driver v2.30.0 to v3.0.0 I get a NotSupportedException when trying to query a collection for a derived type using collection.OfType<DervivedType>().Find(...).

      MongoDB-Server version: 6.0

      MongoDB C# Driver version: 3.0.0

      .NET version: 8.0

      How to Reproduce

      Code that reproduces the issue: https://github.com/mindleaving/mongodb-csharp-v3-polymorphism-issue __

      Additional Background

      I use BsonKnownTypeAttribute to declare derived types on parent class. Using BsonDiscrimnatorAttribute doesn't solve the issue. No class maps are set up.

            Assignee:
            Robert Stam
            Reporter:
            Jan Scholtyssek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: