diff --git a/lib/cursor.js b/lib/cursor.js index fe96398bc6..e0f64b9390 100644 --- a/lib/cursor.js +++ b/lib/cursor.js @@ -1019,7 +1019,7 @@ Cursor.prototype.transformStream = function(options) { */ Cursor.prototype.explain = function(callback) { if (this.operation) { - this.operation.explain = true; + this.operation.options.explain = true; executeOperation(this.s.topology, this.operation, callback); return; } diff --git a/lib/operations/aggregate.js b/lib/operations/aggregate.js index 6386eaa19a..e25d201b07 100644 --- a/lib/operations/aggregate.js +++ b/lib/operations/aggregate.js @@ -96,6 +96,7 @@ class AggregateOperation extends CommandOperationV2 { } if (options.explain) { + options.full = false; command.explain = options.explain; } diff --git a/lib/operations/command_v2.js b/lib/operations/command_v2.js index 1ba8e26479..a6115c1b7f 100644 --- a/lib/operations/command_v2.js +++ b/lib/operations/command_v2.js @@ -29,11 +29,6 @@ class CommandOperationV2 extends OperationBase { } let fullResponse = this.options.full; - if (this.explain) { - cmd = { explain: cmd }; - fullResponse = false; - } - server.command(this.ns.toString(), cmd, this.options, (err, result) => { if (err) { callback(err, null);