Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.4.3
-
using mongo csharp driver 2.4.3
Description
When trying to parse the following query:
var f = Builders<collectionFoo>.Filter; |
var query = f.In("product", some.Products) |
& f.Gte("version", "1.0.0") |
& f.In("version", new List<BsonRegularExpression>() { new BsonRegularExpression("/^1.2.0/"), new BsonRegularExpression("/^1.1.3/") }); |
another ways
new BsonArray(some.versions.Select(x => new BsonRegularExpression(x))) |
new BsonArray(some.versions.Select(x => new RegEx(x))) |
I wanted the following results.
{ "$match" : { "product" : { "$in" : [1, 2, 3, 4] }, "version" : { "$gte" : "1.0.0", "$in" : [/^1.2.0/, /^1.1.3/, .... ] } |
But the result is ...
{ "$match" : { "product" : { "$in" : [1, 2, 3, 4] }, "version" : { "$gte" : "1.0.0", "$in" : ["/^1.2.0/", "/^1.1.3/", ....] } |
using BsonRegularExpression in `$in` command
https://docs.mongodb.com/manual/reference/operator/query/in/
The $in operator can specify matching values using regular expressions of the form /pattern/. You cannot use $regex operator expressions inside an $in.
I want to use regex in '$in' command..
Attachments
Issue Links
- is duplicated by
-
CSHARP-1906 Case insensitive search using $in clause in Linq expressions
-
- Closed
-