create index on aH.uid
> db.testing_ah_array_path_new.find({'aH.sm':'dominik','aH.uid':{'$gte':1, '$lte':1000}}).explain()
{
"cursor" : "BtreeCursor aH_uid_1",
"isMultiKey" : true,
"n" : 276,
"nscannedObjects" : 124565,
"nscanned" : 124565,
"nscannedObjectsAllPlans" : 124667,
"nscannedAllPlans" : 124667,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 1,
"nChunkSkips" : 0,
"millis" : 809,
"indexBounds" :
{
"aH.uid" : [
[
1,
1.7976931348623157e+308
]
]
}
,
}
On the other hand, when changing the '$lte' and '$gte' order
> db.testing_ah_array_path_new.find({'aH.sm':'dominik','aH.uid':{'$lte':1000,'$gte':1}}).explain()
{
"cursor" : "BtreeCursor aH_uid_1",
"isMultiKey" : true,
"n" : 276,
"nscannedObjects" : 276,
"nscanned" : 276,
"nscannedObjectsAllPlans" : 378,
"nscannedAllPlans" : 378,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 2,
"indexBounds" :
{
"aH.uid" : [
[
-1.7976931348623157e+308,
1000
]
]
}
,
}
In both cases, upper and lower bound should be shown as set to 1 and 1000 respectively by explain()