[SERVER-7114] $not + $nin incorrectly matches documents Created: 24/Sep/12 Updated: 15/Feb/13 Resolved: 28/Nov/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Noah McIlraith | Assignee: | Scott Hernandez (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
I'm currently trying to make use of $not and $nin. db.item.find({'tags': {'$not': {'$nin': [1, 2, 3, 4]}}}) In theory this should return items that don't have any tags other than the ones specified, in actuality it seems to turn it into $in. |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 24/Sep/12 ] |
|
Noah, I think what you are arguing an interpretation that is $all, which requires that all the elements in the list exist in the array. Logically a "not + not-in" would equal "in", which is what you said you see. I think you might want a full match on the array with what you pass in for comparison === array equality. |