[DOCS-12060] Improve documentation for Index Prefix Created: 17/Sep/18  Updated: 30/Oct/23

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

Type: Task Priority: Major - P3
Reporter: Nathan Leniz Assignee: Ravind Kumar (Inactive)
Resolution: Won't Do Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769
Story Points: 0.5

 Description   

Description

The documentation for index prefixes https://docs.mongodb.com/manual/core/index-compound/#prefixes never calls out the fact that the following index 

 

{a: 1, b: 1, c: 1}

 

will support the queries

 

db.docs.find({b: "foo", c: "bar", a: "baz"})
db.docs.find({b: "foo", a: "bar"})

 

and so on. We should point out that the query order in this case doesn't matter itself as long as either a subset of the prefix or the entire compound index is used.

 

Scope of changes

  • Update linked section to note that for the query portion of the find (and possibly match?), the order of fields listed does not matter. If the fields specified in the query match a subset of the prefix or the entire compound index, then the query can use the index.
  • Should be explicit here that without a : bar, neither of these can work as noted in the compound index section
  • Check that this is true for $match, or if there are other caveats.


 Comments   
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!

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