[SERVER-1937] $gt/$lt/$ne with scalar operand yields inconsistent matches on arrays Created: 13/Oct/10 Updated: 06/Dec/22 Resolved: 12/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aaron Staple | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 3 |
| Labels: | query-44-grooming, query_triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
When the document in the collection contains an array:
and we run a non-equality query with a scalar operand, we see the following results:
|
| Comments |
| Comment by David Storch [ 12/Jul/19 ] |
|
This is working as designed. The operation {arrayField: {$ne: value}} has the same meaning as {$nor: [{arrayField: {$eq: value}}]}. That is, the expression means "match documents where the array does not contain value" as opposed to "match documents where the array has at least one element which is not equal to value". |