Database Reference
In-Depth Information
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 0,
"nscanned" : 0,
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 1,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 2,
"indexBounds" : {
"ts" : [
[
ISODate("2013-12-01T08:00:00Z"),
ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
]
]
}
}
Of course, a scan of all the customers would still be required. If the
number of customers is small, this may not be a problem, but the hope
is that there would be a very large number of customers. In that case, it
might seem like a good idea to add a customer index:
> db.metrics.ensureIndex({customer_id:1});
> db.metrics.find({customer_id:1,ts:{$gt:new
Date(2013,11,01)}})
.explain()
{
" cursor" : "BtreeCursor ts_1",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 0,
"nscanned" : 0,
Search WWH ::




Custom Search