Details
-
Question
-
Resolution: Works as Designed
-
Major - P3
-
None
-
2.18.0
-
None
Description
Summary
Hi,
I'm getting an exception with simple filtering on ObjectId represented as string inside a C# class.
Exception:
MongoDB.Driver.Linq.ExpressionNotSupportedException: 'Expression not supported: x.SomeId in (x.SomeId == "634cf4c86a1bde31017xxxxx") because field "SomeId" is not represented as a string.'
Call:
someCollection.AsQueryable(options)
.Where(x => x.SomeId == "634cf4c86a1bde31017xxxxx");
Property in the class:
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
public string SomeId { get; set; }
It works with LinqProvider V2.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
2.18.0
How to Reproduce
Call AsQueryable with Where() filtering on objectId as string property inside a class.
Thank you!