Description
Given the following class:
public class C
|
{
|
public int Id;
|
public int Prop;
|
}
|
the following query will throw an InvalidCastException:
var builder = Builders<C>.Filter;
|
var value = 2067L; // note: value is a long
|
var filter = builder.Where(x => x.Prop == value); // note: x.Prop is an int
|
var document = await collection.Find(filter).FirstOrDefaultAsync();
|
Note: this worked in 2.0.2 but no longer works in 2.1.1+.
Attachments
Issue Links
- related to
-
CSHARP-1542 Using abstract type within Queryable Linq statement
-
- Closed
-