[SERVER-4965] $not appears to distribute incorrectly over conjunctions Created: 14/Feb/12 Updated: 29/Feb/12 Resolved: 14/Feb/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 2.0.0, 2.0.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | John R | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
The $not operator appears to incorrectly distribute over (implicit) conjunctions of operators like $in, $gt, etc. Examples: // insert some data ) ) // Example 1 // Example 2 |
| Comments |
| Comment by Aaron Staple [ 14/Feb/12 ] |
|
Also, feel free to file a new ticket requesting different behavior for $not. |
| Comment by Aaron Staple [ 14/Feb/12 ] |
|
Yep, I already filed Btw, you can use $nor to get behavior similar to what you're looking for: {$nor:[{a:{$gt:2,$lt:4}}]} |
| Comment by John R [ 14/Feb/12 ] |
|
It seems that many users would expect the query |
| Comment by Aaron Staple [ 14/Feb/12 ] |
|
This is the behavior that was designed for $not. $not is a meta operator - it just reverses the matching behavior of the operators in a sub object. It does not reverse the matching behavior of a conjunction of operators in a subobject. |