driver-legacy/src/main/com/mongodb/DBCollection.java
public CommandResult explainAggregate(final List<? extends DBObject> pipeline, final AggregationOptions options) {
        AggregateOperation<BsonDocument> operation = new AggregateOperation<BsonDocument>(getNamespace(), preparePipeline(pipeline),
                                                                                          new BsonDocumentCodec())
                                                         .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS)
                                                         .allowDiskUse(options.getAllowDiskUse())
                                                         .collation(options.getCollation())
                                                         .retryReads(retryReads);
        return new CommandResult(executor.execute(operation.asExplainableOperation(ExplainVerbosity.QUERY_PLANNER), primaryPreferred(),
                getReadConcern()));
    }
public CommandResult explainAggregate(final List<? extends DBObject> pipeline, final AggregationOptions options) {
        AggregateOperation<BsonDocument> operation = new AggregateOperation<BsonDocument>(getNamespace(), preparePipeline(pipeline),
                                                                                          new BsonDocumentCodec())
                                                         .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS)
                                                         .allowDiskUse(options.getAllowDiskUse())
                                                         .collation(options.getCollation())
                                                         .retryReads(retryReads);
        return new CommandResult(executor.execute(operation.asExplainableOperation(ExplainVerbosity.QUERY_PLANNER), primaryPreferred(),
                getReadConcern()));
    }
public CommandResult explainAggregate ( final List < ? extends DBObject > pipeline , final AggregationOptions options ) { AggregateOperation < BsonDocument > operation = new AggregateOperation < BsonDocument > ( getNamespace ( ) , preparePipeline ( pipeline ) , new BsonDocumentCodec ( ) ) . maxTime ( options . getMaxTime ( MILLISECONDS ) , MILLISECONDS ) . allowDiskUse ( options . getAllowDiskUse ( ) ) . collation ( options . getCollation ( ) ) . retryReads ( retryReads ) ; return new CommandResult ( executor . execute ( operation . asExplainableOperation ( ExplainVerbosity . QUERY_PLANNER ) , primaryPreferred ( ) , getReadConcern ( ) ) ) ; }
Return the explain plan for the aggregation pipeline.

@param pipeline the aggregation pipeline to explain
@param options  the options to apply to the aggregation
@return the command result.  The explain output may change from release to release, so best to simply log this.
@mongodb.driver.manual core/aggregation-pipeline/ Aggregation
@mongodb.driver.manual reference/operator/meta/explain/ Explain query
@mongodb.server.release 2.6
Return the explain plan for the aggregation pipeline .