[SERVER-35337] Implement/test existence and null comparison queries using "allPaths" indexes Created: 01/Jun/18 Updated: 29/Oct/23 Resolved: 24/Aug/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.3 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | Ian Boros |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | Query 2018-08-13, Query 2018-08-27, Query 2018-09-10 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
"allPaths" indexes have a sparseness property by default, so the planning behavior is special for $exists:true, $exists:false, $eq:null, $ne:null, etc. |
| Comments |
| Comment by Githook User [ 24/Aug/18 ] |
|
Author: {'name': 'samontea', 'email': 'merciers.merciers@gmail.com', 'username': 'samontea'}Message: |
| Comment by James Wahlin [ 31/Jul/18 ] |
|
After further discussion, it looks like we could support null and existence queries using an "allPaths" index, given we generate keys for empty objects and empty top level arrays. These keys would be used for existence checks only, as we will continue to store leaf nodes for objects rather than than whole objects when non-empty. |
| Comment by Ian Boros [ 30/Jul/18 ] |
|
As part of this ticket we should talk to Asya and be sure she's okay with not supporting this behavior. |
| Comment by James Wahlin [ 30/Jul/18 ] |
|
It is likely that "allPaths" indexes will not be able to support $exists queries. As it stands, we will not create an index entry for an object such as: { a: {} }, but existence or non-existence of such an object will impact the result of an existence query. Queries on equality to null will be similarly impacted as null can match on either an existing field with a null value or a missing field. |