Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
1.7.4
-
None
-
None
-
ALL
Description
It seems like it doesn't use the index (no indexOnly) to get data in the last find.
> for (var i = 1; i <= 10000; i++) db.things.save(
{value : i});
> db.things.find({value:{$gt: 500}}).explain()
{
"cursor" : "BasicCursor",
"nscanned" : 10000,
"nscannedObjects" : 10000,
"n" : 9500,
"millis" : 15,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
}
}
> db.things.ensureIndex(
)
> db.things.find({value:{$gt: 500}},
).explain()
{
"cursor" : "BtreeCursor value_1",
"nscanned" : 9500,
"nscannedObjects" : 9500,
"n" : 9500,
"millis" : 19,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}