I\'m running a MongoDB server (that\'s literally all it has running). The server has 64gb of RAM and 16 cores, plus 2TB of hard drive space to work with.
The Doc
Bumped into a very similar problem, and the Indexing Advice and FAQ on Mongodb.org says, quote:
The range query must also be the last column in an index
So if you have the keys a,b and c and run db.ensureIndex({a:1, b:1, c:1}), these are the "guidelines" in order use the index as much as possible:
Good:
find(a=1,b>2)
find(a>1 and a<10)
find(a>1 and a<10).sort(a)
Bad:
Only use a range query OR sort on one column. Good:
find(a=1,b=2).sort(c)
find(a=1,b>2)
find(a=1,b>2 and b<4)
find(a=1,b>2).sort(b)
Bad:
find(a>1,b>2)
find(a=1,b>2).sort(c)
Hope it helps!
/J