Skip to content

Commit

Permalink
fix: preserve aggregate explain support for legacy servers
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst authored and daprahamian committed Aug 13, 2019
1 parent 0edaa52 commit 032b204
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/operations/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class AggregateOperation extends CommandOperationV2 {
}

if (options.explain) {
options.full = false;
command.explain = options.explain;
}

Expand Down
5 changes: 0 additions & 5 deletions lib/operations/command_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 032b204

Please sign in to comment.