[SERVER-36635] Inconsistent query results with and without presence of partial indexes Created: 14/Aug/18 Updated: 07/Jun/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Ian Boros | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | mql-semantics, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query Execution
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
A fun fact about our query language which I recently learned is that {$ne: null} doesn't necessarily return a subset of what {$exists: true} returns:
When we create a partial index using a filter {$exists: true}, we do not respect these semantics for {$ne: null}:
The results from (1) will be different than those from (2). I think the bug is here. This code basically says "{$ne: null} is a subset of {$exists true}". |
| Comments |
| Comment by Asya Kamsky [ 17/Aug/18 ] | ||||||||||||||||||||||||||
|
charlie.swanson amended with version - it is fixed in 4.1.1. However, original behavior is not about existence of a partial index - it's about the fact that our query semantics don't treat {foo:{$ne:null} as subset of {foo:{$exists:true} which is SERVER-36681. I think this is a duplicate of SERVER-36681 - the fact that something can be not equal to null but at the same time not considered to exist. | ||||||||||||||||||||||||||
| Comment by Charlie Swanson [ 17/Aug/18 ] | ||||||||||||||||||||||||||
|
asya can you test that again after | ||||||||||||||||||||||||||
| Comment by Asya Kamsky [ 17/Aug/18 ] | ||||||||||||||||||||||||||
|
This is not specific to partial indexes in versions before 4.1.1:
This is with regular index against 4.0. |