File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export const ExplainVerbosity = Object.freeze({
9
9
} as const ) ;
10
10
11
11
/** @public */
12
- export type ExplainVerbosity = typeof ExplainVerbosity [ keyof typeof ExplainVerbosity ] ;
12
+ export type ExplainVerbosity = string ;
13
13
14
14
/**
15
15
* For backwards compatibility, true is interpreted as "allPlansExecution"
@@ -35,20 +35,18 @@ export class Explain {
35
35
? ExplainVerbosity . allPlansExecution
36
36
: ExplainVerbosity . queryPlanner ;
37
37
} else {
38
- this . verbosity = ExplainVerbosity [ verbosity ] ;
38
+ this . verbosity = verbosity ;
39
39
}
40
40
}
41
41
42
42
static fromOptions ( options ?: ExplainOptions ) : Explain | undefined {
43
43
if ( options ?. explain === undefined ) return ;
44
44
45
45
const explain = options . explain ;
46
- if ( typeof explain === 'boolean' || explain in ExplainVerbosity ) {
46
+ if ( typeof explain === 'boolean' || typeof explain === 'string' ) {
47
47
return new Explain ( explain ) ;
48
48
}
49
49
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' ) ;
53
51
}
54
52
}
You can’t perform that action at this time.
0 commit comments