-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
-
0.5
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.