[SERVER-19175] add support for $pull with $not Created: 28/Jun/15 Updated: 06/Dec/22 Resolved: 30/Jun/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 3.0.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Benjamin M | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Assigned Teams: |
Query
|
| Operating System: | ALL |
| Participants: |
| Description |
Example document:
I want to remove all values that are $lt: 4 or null. To simplify thing I wanted to use $not: { $gte: 4 }. This works:
And this does not work:
It gives the following error:
Am I doing something wrong or is there another way to do this? |
| Comments |
| Comment by Asya Kamsky [ 30/Jun/19 ] | ||||
|
You can see some examples here. Examples in this ticket can be done by setting the array to its new value using aggregation array expression $filter which takes arbitrarily complex conditional. | ||||
| Comment by Benjamin M [ 30/Jun/15 ] | ||||
|
It's not only $not, because $or doesn't work, too. There may be some more expressions. | ||||
| Comment by Sam Kleinman (Inactive) [ 30/Jun/15 ] | ||||
|
Thanks for the report, I've attached a test case that demonstrates the inconsistency between $lt and $not $gte within $pull expressions, and am passing this on to the query team for additional triage. | ||||
| Comment by Benjamin M [ 28/Jun/15 ] | ||||
|
You can close this, it's a duplicate of https://jira.mongodb.org/browse/SERVER-19172 | ||||
| Comment by Benjamin M [ 28/Jun/15 ] | ||||
|
Why there's no EDIT button? In the not working query is a mistake. Should be foo.bar instead of foo.baz : And this does not work:
|