|
Example query results:
> db.foo.find({a: 1, b: 1}, {_id: 0, a: 1, b: 1})
|
{ "a" : 1, "b" : 2 }
|
Query execution stats:
> db.foo.find({a: 1, b: 1}, {_id: 0, a: 1, b: 1}).explain("executionStats")
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.foo",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"$and" : [
|
{
|
"a" : {
|
"$eq" : 1
|
}
|
},
|
{
|
"b" : {
|
"$eq" : 1
|
}
|
}
|
]
|
},
|
"winningPlan" : {
|
"stage" : "PROJECTION",
|
"transformBy" : {
|
"_id" : 0,
|
"a" : 1,
|
"b" : 1
|
},
|
"inputStage" : {
|
"stage" : "KEEP_MUTATIONS",
|
"inputStage" : {
|
"stage" : "AND_SORTED",
|
"inputStages" : [
|
{
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"a" : 1
|
},
|
"indexName" : "a_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"a" : [
|
"[1.0, 1.0]"
|
]
|
}
|
},
|
{
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"b" : 1
|
},
|
"indexName" : "b_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"b" : [
|
"[1.0, 1.0]"
|
]
|
}
|
}
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [
|
{
|
"stage" : "PROJECTION",
|
"transformBy" : {
|
"_id" : 0,
|
"a" : 1,
|
"b" : 1
|
},
|
"inputStage" : {
|
"stage" : "KEEP_MUTATIONS",
|
"inputStage" : {
|
"stage" : "FETCH",
|
"filter" : {
|
"a" : {
|
"$eq" : 1
|
}
|
},
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"b" : 1
|
},
|
"indexName" : "b_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"b" : [
|
"[1.0, 1.0]"
|
]
|
}
|
}
|
}
|
}
|
},
|
{
|
"stage" : "PROJECTION",
|
"transformBy" : {
|
"_id" : 0,
|
"a" : 1,
|
"b" : 1
|
},
|
"inputStage" : {
|
"stage" : "KEEP_MUTATIONS",
|
"inputStage" : {
|
"stage" : "FETCH",
|
"filter" : {
|
"b" : {
|
"$eq" : 1
|
}
|
},
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"a" : 1
|
},
|
"indexName" : "a_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"a" : [
|
"[1.0, 1.0]"
|
]
|
}
|
}
|
}
|
}
|
}
|
]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 1,
|
"executionTimeMillis" : 52,
|
"totalKeysExamined" : 1002,
|
"totalDocsExamined" : 0,
|
"executionStages" : {
|
"stage" : "PROJECTION",
|
"nReturned" : 1,
|
"executionTimeMillisEstimate" : 10,
|
"works" : 1003,
|
"advanced" : 1,
|
"needTime" : 1001,
|
"needFetch" : 0,
|
"saveState" : 503,
|
"restoreState" : 503,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"transformBy" : {
|
"_id" : 0,
|
"a" : 1,
|
"b" : 1
|
},
|
"inputStage" : {
|
"stage" : "KEEP_MUTATIONS",
|
"nReturned" : 1,
|
"executionTimeMillisEstimate" : 10,
|
"works" : 1003,
|
"advanced" : 1,
|
"needTime" : 1001,
|
"needFetch" : 0,
|
"saveState" : 503,
|
"restoreState" : 503,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"inputStage" : {
|
"stage" : "AND_SORTED",
|
"nReturned" : 1,
|
"executionTimeMillisEstimate" : 10,
|
"works" : 1003,
|
"advanced" : 1,
|
"needTime" : 1001,
|
"needFetch" : 0,
|
"saveState" : 503,
|
"restoreState" : 503,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"flagged" : 0,
|
"matchTested" : 0,
|
"failedAnd_0" : 0,
|
"failedAnd_1" : 0,
|
"inputStages" : [
|
{
|
"stage" : "IXSCAN",
|
"nReturned" : 1,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 2,
|
"advanced" : 1,
|
"needTime" : 0,
|
"needFetch" : 0,
|
"saveState" : 503,
|
"restoreState" : 503,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"a" : 1
|
},
|
"indexName" : "a_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"a" : [
|
"[1.0, 1.0]"
|
]
|
},
|
"keysExamined" : 1,
|
"dupsTested" : 0,
|
"dupsDropped" : 0,
|
"seenInvalidated" : 0,
|
"matchTested" : 0
|
},
|
{
|
"stage" : "IXSCAN",
|
"nReturned" : 1001,
|
"executionTimeMillisEstimate" : 10,
|
"works" : 1001,
|
"advanced" : 1001,
|
"needTime" : 0,
|
"needFetch" : 0,
|
"saveState" : 503,
|
"restoreState" : 503,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"b" : 1
|
},
|
"indexName" : "b_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"b" : [
|
"[1.0, 1.0]"
|
]
|
},
|
"keysExamined" : 1001,
|
"dupsTested" : 0,
|
"dupsDropped" : 0,
|
"seenInvalidated" : 0,
|
"matchTested" : 0
|
}
|
]
|
}
|
}
|
}
|
},
|
"serverInfo" : {
|
"host" : "rassi",
|
"port" : 27017,
|
"version" : "2.8.0-rc5-pre-",
|
"gitVersion" : "e35f2d62ccabee95075dd03d2eac85339e063e37"
|
},
|
"ok" : 1
|
}
|
>
|
|