-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance, Performance
Currently you can hint to use an index for range+equlity matches but the index will not be considered otherwise. I would like to see it be considered like any other potential index.
Example of desired behavior:
db.coll.insert({a:twoDaysAgoDate, b:2}) ... // millions of docs where a is less than 2 days ago db.coll.ensureIndex({a:1,b:1}) db.coll.find({a:{$gt:oneDayAgoDate}, b:2}) //uses index, doesn't now.