MongoDB docs advices that:
The sort column must be the last column used in the index
Here is the example:
db.foo.ensureIndex({a: 1, b: 1, c: 1})
Good:
find(a=1).sort(a)
find(a=1).sort(b)
find(a=1, b=2).sort(c)
Bad:
find(a=1).sort(c)
even though c is the last column used in the index, a is that last column used, so you can only sort on a or b.
can someone explain this. Why find(a=1).sort(c) considered as Bad?