-
Type: Bug
-
Resolution: Gone away
-
Priority: Unknown
-
None
-
Affects Version/s: 3.0.0
-
Component/s: API
-
None
-
Dotnet Drivers
Summary
After upgrade to v3.0.0 simple OfType() query on polymorphic collection throws System.NotSupportedException: OfType is not supported with the configured discriminator convention.
In previous versions worked fine.
How to Reproduce
var client = new MongoClient("mongodb://root:root@localhost:27017"); var collection = client.GetDatabase("test").GetCollection<Animal>("animals"); var dogs = collection.OfType<Dog>().Find(Builders<Dog>.Filter.Empty).ToList(); [BsonKnownTypes(typeof(Dog))] public abstract class Animal { public ObjectIdId { get; set; } } public class Dog : Animal {}
- duplicates
-
CSHARP-5356 Support `OfType` and `is` with scalar discriminators when using class mapped serializers
- In Code Review