Description:
This following topic needs an update: https://docs.mongodb.com/master/reference/explain-results/
The queryPlanner output may include a new field 'optimizedPipeline: true' to indicate that this plan represents an aggregation request where the pipeline has been optimized away and the request is answered using the query engine only. Note that this is either 'optimizedPipeline: true' or no field at all. That is, 'optimizedPipeline: false' can never appear in the output. Here is an example:
"queryPlanner" : {
"plannerVersion" : <int>,
"namespace" : <string>,
"indexFilterSet" : <boolean>,
"parsedQuery" :
Unknown macro: {
...
}
,
"queryHash" : <hexadecimal string>,
"planCacheKey" : <hexadecimal string>,
"optimizedPipeline" : true,
Engineering Ticket Description:
An aggregation pipeline can be used to represent a query, like the following:
db.example.aggregate([{$project: {excluded: 0}}, {$match: {predicate: true}}]);
|
In these cases, it would be more efficient to skip the aggregation layer, and execute the entire computation using a query.
It is expected that pipelines like the above pipeline will be much more common once non-materialized views are introduced in SERVER-142.