Why MongoDB cannot use a compound index that is much similar(not exact) to the query?
问题 Consider the below Mongo index strategy and the query, Index: db.collec.ensureIndex({a:1,b:1,c:1}); Query: db.collec.find({"a":"valueA"},{"_id":0,"a":1,"c":1}).sort({"c":-1}).limit(150) The explain on the above query returns: /* 0 */ { "cursor" : "BtreeCursor a_1_b_1_c_1", "isMultiKey" : false, "n" : 150, "nscannedObjects" : 178, "nscanned" : 178, "nscannedObjectsAllPlans" : 279, "nscannedAllPlans" : 279, "scanAndOrder" : true, "indexOnly" : true, "nYields" : 0, "nChunkSkips" : 0, "millis" :