Skip to content

Commit 371271d

Browse files
remove gaurd against double explain
1 parent 0e44b81 commit 371271d

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/utils.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,6 @@ export function decorateWithExplain(
260260
maxTimeMS?: number;
261261
} {
262262
type ExplainCommand = ReturnType<typeof decorateWithExplain>;
263-
const isExplainCommand = (doc: Document): doc is ExplainCommand => 'explain' in command;
264-
265-
if (isExplainCommand(command)) {
266-
return command;
267-
}
268-
269263
const { verbosity, maxTimeMS } = explain;
270264
const baseCommand: ExplainCommand = { explain: command, verbosity };
271265

test/unit/utils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,11 +1007,11 @@ describe('driver utils', function () {
10071007
});
10081008

10091009
describe('decorateWithExplain()', function () {
1010-
it('when the command is a valid explain command, the command is returned unmodified', function () {
1011-
const command = Object.freeze({ explain: { hello: 'world' } });
1010+
it('when the command is a valid explain command, the command is still wrapped', function () {
1011+
const command = { explain: { hello: 'world' } };
10121012
const result = decorateWithExplain(command, Explain.fromOptions({ explain: true }));
10131013

1014-
expect(result).to.deep.equal(command);
1014+
expect(result).to.deep.equal({ explain: command, verbosity: 'allPlansExecution' });
10151015
});
10161016

10171017
it('when the options have a maxTimeMS, it is attached to the explain command', function () {

0 commit comments

Comments
 (0)