-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: 2.14.0
-
Component/s: LINQ3
-
None
-
Minor Change
Repro:
using MongoDB.Bson; using MongoDB.Driver; using MongoDB.Driver.Linq; var settings = new MongoClientSettings { LinqProvider = LinqProvider.V3 }; var client = new MongoClient(settings); var db = client.GetDatabase("test"); var coll = db.GetCollection<C>("coll"); var query = coll.Find(x => x.Text.StartsWith(x.Match, StringComparison.CurrentCultureIgnoreCase)); Console.WriteLine(query); record C(ObjectId Id, string Text, string Match);
Output:
find({ "$expr" : { "$eq" : [{ "$indexOfCP" : [{ "$toLower" : "$Text" }, { "$toLower" : { "$toLower" : "$Text" } }] }, 0] } })
The correct MQL should be:
find({ "$expr" : { "$eq" : [{ "$indexOfCP" : [{ "$toLower" : "$Text" }, { "$toLower" : "$Match" }] }, 0] } })