The cursor.explain() output includes a field called "coveredIndex":
> db.zips.find({city: "NEW YORK"}).explain()
{
"cursor" : "BtreeCursor city_1",
"isMultiKey" : false,
"n" : 40,
"nscannedObjects" : 40,
"nscanned" : 40,
"nscannedObjectsAllPlans" : 40,
"nscannedAllPlans" : 40,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"city" : [
[
"NEW YORK",
"NEW YORK"
]
]
},
"server" : "localhost:27017"
}
For the equivalent field, aggregation explain uses the name "coveredIndex":
db.runCommand({ aggregate: "zips", explain: true, pipeline: [ {$match: {city: "NEW YORK"}} ] })
{
"stages" : [
{
"$cursor" : {
"query" : {
"city" : "NEW YORK"
},
"coveredIndex" : false,
"cursorType" : "BtreeCursor city_1"
}
}
],
"ok" : 1
}
Let's unify our terminology by changing explain for aggregation to "indexOnly".