[DOCS-16016] [Server] Incorrect documentation section on unsupported query operations in wildcard indexes Created: 06/Apr/23 Updated: 30/Oct/23 Resolved: 11/Apr/23 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual, Server |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Task | Priority: | Critical - P2 |
| Reporter: | Alexander Ignatyev | Assignee: | Jeffrey Allen |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Days since reply: | 43 weeks, 5 days ago | ||||||||
| Description |
|
Wildcard Indexes are always sparse indexes by default, therefore, as other sparse indexes they cannot answer queries in case of incomplete results ({$exists: true}, {$eq: null}). However, they can answer queries with {$ne: null}: 1. https://www.mongodb.com/docs/manual/core/index-wildcard/#unsupported-query-patterns. Statement "Wildcard indexes cannot support query condition that checks if a field is not equal to null." should be replaced to "Wildcard indexes cannot support query condition that checks if a field is equal to null." Section "Field is not equal to null" should be renamed to something like "Array Field equality to null". And the section's text "If a given field is an array in any document in the collection, wildcard indexes cannot support queries for documents where that field is not equal to null. For example, consider a collection inventory with a wildcard index on product_attributes. The wildcard index cannot support the following queries if product_attributes.tags is an array in any document in the collection:" should be rewritten to something like "If a given field is an array in any document in the collection, wildcard indexes cannot support queries for documents where that field is equal or not equal to null. For example, consider a collection inventory with a wildcard index on product_attributes. The wildcard index cannot support the following queries if product_attributes.tags is an array in any document in the collection:" The examples to the section contain incorrect MQL and should be replaced to
A new section should be added: Field is equal to null Wildcard indexes cannot support queries for documents where a field is equal to null. This is because the semantics of {$eq: null} is such that it must match all documents where the field is explicitly null or missing, and wildcard indexes, being sparse, do not index the latter documents. For example, consider a collection inventory with a wildcard index on product_attributes. The wildcard index cannot support the following queries:
One workaround is to to use {$type: 10} instead:
3. https://www.mongodb.com/docs/manual/core/index-sparse/#indexes-that-are-sparse-by-default Statement "2dsphere (version 2), 2d, geoHaystack, and text indexes are always sparse." should rewritten with a link to wildcard indexes added, e.g.: Not required but good to have for completeness. |
| Comments |
| Comment by Jeffrey Allen [ 07/Apr/23 ] |
|
Hi alexander.ignatyev@mongodb.com , could you please review this PR? https://github.com/10gen/docs-mongodb-internal/pull/2899 Thanks! |
| Comment by Jeffrey Allen [ 07/Apr/23 ] |
|
PR: https://github.com/10gen/docs-mongodb-internal/pull/2899 |
| Comment by Sarah Olson [ 07/Apr/23 ] |
|
We'll be working on this. It duplicates https://jira.mongodb.org/browse/DOCS-16010, which we closed as this ticket has more detail. |