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

Querying polymorphic type causes NotSupportedException

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

      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@mongodb.com Robert Stam
            Reporter:
            mindleaving@gmail.com Jan Scholtyssek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: