-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: 3.6.0
-
Component/s: LINQ
-
None
-
None
-
Dotnet Drivers
-
None
-
None
-
None
-
None
-
None
-
None
The following `Where` statements are translated to a `$match` stage using `$expr` filter:
queryable.Where(x.S.IndexOf("a") == -1) queryable.Where(x.S.IndexOf("a") != -1) queryable.Where(x.S.IndexOf("a") < 0) queryable.Where(x.S.IndexOf("a") >= 0
but could be translated more efficiently using regular expressions.
The existing support for translating `IndexOf` comparisons to regular expressions only supports `==` and `!=" and only when compared to non-negative integers.
One approach to implement this would be to modify the existing code, but the existing code is complicated (because it handles lots of scenarios) and care would have to be taken to not break anything. If that proves difficult, it might be easier to implement these 4 cases with an entirely new code path.
- related to
-
CSHARP-5654 String.IndexOf comparisons to -1 return incorrect results
-
- In Code Review
-