Skip to content

Commit 1a57ba8

Browse files
authored
fix(NODE-3335): do not validate explain verbosity in client (#2834)
1 parent 079bd6c commit 1a57ba8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/explain.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const ExplainVerbosity = Object.freeze({
99
} as const);
1010

1111
/** @public */
12-
export type ExplainVerbosity = typeof ExplainVerbosity[keyof typeof ExplainVerbosity];
12+
export type ExplainVerbosity = string;
1313

1414
/**
1515
* For backwards compatibility, true is interpreted as "allPlansExecution"
@@ -35,20 +35,18 @@ export class Explain {
3535
? ExplainVerbosity.allPlansExecution
3636
: ExplainVerbosity.queryPlanner;
3737
} else {
38-
this.verbosity = ExplainVerbosity[verbosity];
38+
this.verbosity = verbosity;
3939
}
4040
}
4141

4242
static fromOptions(options?: ExplainOptions): Explain | undefined {
4343
if (options?.explain === undefined) return;
4444

4545
const explain = options.explain;
46-
if (typeof explain === 'boolean' || explain in ExplainVerbosity) {
46+
if (typeof explain === 'boolean' || typeof explain === 'string') {
4747
return new Explain(explain);
4848
}
4949

50-
throw new MongoDriverError(
51-
`explain must be one of ${Object.keys(ExplainVerbosity)} or a boolean`
52-
);
50+
throw new MongoDriverError('explain must be a string or a boolean');
5351
}
5452
}

0 commit comments

Comments
 (0)