jstests/libs/analyze_plan.js
/**
 * Returns true if the BSON representation of a plan rooted at 'root' is using the aggregation
 * framework, and false otherwise.
 */
Returns true if the BSON representation of a plan rooted at 'root' is using the aggregation
framework, and false otherwise.
Returns true if the BSON representation of a plan rooted at ' root ' is using the aggregation framework and false otherwise .
function isAggregationPlan(root) {
    if (root.hasOwnProperty("shards")) {
        const shards = Object.keys(root.shards);
        return shards.reduce(
                   (res, shard) => res + root.shards[shard].hasOwnProperty("stages") ? 1 : 0, 0) >
            0;
    }
    return root.hasOwnProperty("stages");
}
function isAggregationPlan ( root ) { if ( root . hasOwnProperty ( "shards" ) ) { const shards = Object . keys ( root . shards ) ; return shards . reduce ( ( res , shard ) => res + root . shards [ shard ] . hasOwnProperty ( "stages" ) ? 1 : 0 , 0 ) > 0 ; } return root . hasOwnProperty ( "stages" ) ; }
Returns true if the BSON representation of a plan rooted at 'root' is using the aggregation
 framework, and false otherwise.
Returns true if the BSON representation of a plan rooted at ' root ' is using the aggregation framework and false otherwise .