[CSHARP-1543] Query Lambdas: "!a.b.Any()" supported, but "a.b.Any() == false" fails Created: 22/Jan/16 Updated: 06/Jul/17 Resolved: 11/Mar/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.2 |
| Fix Version/s: | 2.2.4 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Kevin Versfeld | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Recently did a long overdue upgrade from 1.(something) to 2.2, and am having lots of trouble migrating my wrapper code across. One thing I'm noticing is that lots of expressions I had been using previously (via linq) are simply not supported anymore, which is very odd to me. Could you clarify whether this is by design/known/etc? Works: Does not work: I will provide further info on other lambdas that are problematic, later. |
| Comments |
| Comment by Githook User [ 11/Mar/16 ] |
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: |
| Comment by Githook User [ 11/Mar/16 ] |
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: |
| Comment by Craig Wilson [ 10/Feb/16 ] |
|
Hi, Kevin. The fix for it not working in LINQ is part of this ticket: We also currently don't have support for injecting FilterExpressions or other such things. We are really trying to get everything working with vanilla linq. At some point, we might need to do this, but I don't feel like we are there yet. Craig |
| Comment by Kevin Versfeld [ 09/Feb/16 ] |
|
I'm struggling with how to query a collection looking for documents which have particular values in an array (coming from a Dictionary originally). I believe "ElemMatch" is what I'm after. Anyway, documentation I think indicates I can do something like this to achieve ElemMatch: But both of these just give me the error " Is this something that should be working? Have I misunderstood? Is there still a way to use Inject? (I can post the error I get on that one, if necessary) I posted this in the User group, but no luck yet: |
| Comment by Kevin Versfeld [ 28/Jan/16 ] |
|
Gotcha, thanks. |
| Comment by Craig Wilson [ 28/Jan/16 ] |
|
Yes, the final version you tried is the proper form for this. We removed the special "ContainsAny" extension method. |
| Comment by Kevin Versfeld [ 28/Jan/16 ] |
|
Another one: I used to use this in much older versions of driver:
which no longer works.
which also didn't work, and now use this (which does work):
Is this expected/correct? |
| Comment by Kevin Versfeld [ 22/Jan/16 ] |
|
thanks for the super fast response Craig, I will do. |
| Comment by Craig Wilson [ 22/Jan/16 ] |
|
All expressions should work. Any that don't work are missing a test as the new linq parser passes the old test suite. Please push any more you find to this ticket and we'll tackle them all at once. Craig |