[CSHARP-650] Support LINQ All by converting to !Any Created: 19/Dec/12 Updated: 04/May/15 Resolved: 04/May/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Zaid Masud | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | driver, linq, linq,query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Rewrite Linq |
| Description |
|
The following two LINQ queries are semantically equivalent:
The second LINQ query is supported by the C# driver, whereas the first is not. In principle it should be possible to support the first query as well by translating it into the second query. |
| Comments |
| Comment by Craig Wilson [ 04/May/15 ] |
|
Hi Zaid/Kirill, We are not going to implement this. The change in the expression tree is fairly complex. While the PR handles the simple situation, it missed the edge cases related to conjunctions (and and or). These particular changes aren't even legal as elemMatch queries to the server. As such, I think it best that we keep this simple and just not support All at all. Craig |
| Comment by Kirill Davletkildeev [ 12/Feb/13 ] |
|
Submitted a pull request |
| Comment by Kirill Davletkildeev [ 12/Feb/13 ] |
|
Nice idea! Just one addition: the inverted query should look like c != null && !c.Any(d => !d.Field). |