[CSHARP-493] LINQ - Allow Regex Usage inside $all Created: 13/Jun/12 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Zaid Masud | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
There appears to be no LINQ way to perform the following Mongo query: db.Collection.find({field : {$all : [ /^a/, /^d/]}}) One possible suggestion to implement this is to create a ContainsAll overload that receives Regex parameters. |
| Comments |
| Comment by Zaid Masud [ 15/Jun/12 ] |
|
This is a bit of a tangent to the specific issue reported here, but one thing we have seen with these custom extension methods is that unit testing becomes difficult. So for example, if our unit tests are using in-memory objects then ContainsAll won't work. Here are two alternatives to ContainsAll using standard LINQ/.NET framework: 1) Support IsSubsetOf on two HashSets – this is the most natural C# interpretation of ContainsAll ... $all is really a Subset predicate. Of course neither would support regexes, so perhaps ContainsAll will still be needed for Regexes on $all. |