Skip to content

Commit 032b204

Browse files
mbroadstdaprahamian
authored andcommitted
fix: preserve aggregate explain support for legacy servers
1 parent 0edaa52 commit 032b204

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

lib/cursor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ Cursor.prototype.transformStream = function(options) {
10191019
*/
10201020
Cursor.prototype.explain = function(callback) {
10211021
if (this.operation) {
1022-
this.operation.explain = true;
1022+
this.operation.options.explain = true;
10231023
executeOperation(this.s.topology, this.operation, callback);
10241024
return;
10251025
}

lib/operations/aggregate.js

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class AggregateOperation extends CommandOperationV2 {
9696
}
9797

9898
if (options.explain) {
99+
options.full = false;
99100
command.explain = options.explain;
100101
}
101102

lib/operations/command_v2.js

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ class CommandOperationV2 extends OperationBase {
2929
}
3030

3131
let fullResponse = this.options.full;
32-
if (this.explain) {
33-
cmd = { explain: cmd };
34-
fullResponse = false;
35-
}
36-
3732
server.command(this.ns.toString(), cmd, this.options, (err, result) => {
3833
if (err) {
3934
callback(err, null);

0 commit comments

Comments
 (0)