> part.findOne()
{
"_id" : ObjectId("54bf9b01bef23df039fb0caf"),
"mac" : "0026C76A6E08",
"location" : {
"timestamp" : ISODate("2015-01-21T12:27:31Z"),
"pos_status" : 0,
"x" : 49.37150573730469,
"y" : 5.593080043792725,
"ip" : ""
},
"customer" : [ ],
"ofi" : [
{
"oft" : 0,
"id" : "0"
},
{
"oft" : 0,
"id" : "1"
},
{
"oft" : 0,
"id" : "A"
}
]
}
> part.ensureIndex({'location.timestamp': 1, 'ofi.id': 1})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 2,
"numIndexesAfter" : 3,
"ok" : 1
}
> part.find({'location.timestamp': {'$gte': new Date('2015-01-21 12:00:00'), '$lt': new Date('2015-01-21 22:00:00')}}).hint({'location.timestamp':1, 'ofi.id': 1}).explain()
{
"cursor" : "BtreeCursor location.timestamp_1_ofi.id_1",
"isMultiKey" : true,
"n" : 500,
"nscannedObjects" : 500,
"nscanned" : 1500,
"nscannedObjectsAllPlans" : 500,
"nscannedAllPlans" : 1500,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 11,
"nChunkSkips" : 0,
"millis" : 2,
"indexBounds" : {
"location.timestamp" : [
[
true,
ISODate("2015-01-21T14:00:00Z")
]
],
"ofi.id" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"server" : "smartac-2015:27017",
"filterSet" : false
}