[DOCS-14734] Please document how Partial vs. Sparse compound indexes work Created: 13/Aug/21  Updated: 30/Oct/23

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Johnny Shields Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 41 weeks, 6 days ago
Epic Link: DOCSP-11702

 Description   

On this page you describe how a sparse single-key index can be represented as a partial index:

https://docs.mongodb.com/manual/core/index-partial/#std-label-index-type-partial

However, there is no documentation for how sparse compound indexes can be represented as an equivalent partial index.

For example, is the index:

db.contacts.createIndex(
   { name: 1, email: 1 },
   { sparse: true }
)

 the same as:

db.contacts.createIndex(
   { name: 1, email: 1 },
   { partialFilterExpression: { name: { $exists: true }, email: { $exists: true } } }
)

In my understanding, sparse implies an OR condition (name exists OR email exists), however it doesn't seem partial supports OR.

(*If we cannot get the same functionality using partial, then it should not be said that "partial is a superset of sparse")

 



 Comments   
Comment by Johnny Shields [ 20/Apr/23 ]

Please reopen.

Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Comment by Johnny Shields [ 04/Sep/21 ]

Any updates on this? Should be relatively straightforward to do...

Generated at Thu Feb 08 08:11:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.