-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
Currently, our documentation does not have information that specifically talks about designing indexes using the Equality-Sort-Range rule. The online trainings talk about the E-S-R rule in depth, however the docs do not mention it.
It would be nice to add a blurb like this one, to our index documentation:
The optimal index for a given query can usually be found with the equality-sort-range rule, which indicates that in an index, the equality fields should be first, then the sort fields, and finally the range fields. So, for example, let's consider this query: db.test.find({a:'x', b: {$gt: 10}}).sort(}}{{{c:1}}} Here, `a` is an equality based match, `b` is a range based match, and `c` is used for sorting. Following the equality-sort-range rule, the most optimal index for the above query will be: `{a:1, c:1, b:1}`
Scope of Changes
- A new page or section possibly under Indexing Strategies to cover ESR
- Need to frame carefully as a guideline and not an all-encompassing rule