MCPcopy
hub / github.com/mongodb/node-mongodb-native / decorateWithExplain

Function decorateWithExplain

src/explain.ts:107–124  ·  src/explain.ts::decorateWithExplain
(
  command: Document,
  explain: Explain
)

Source from the content-addressed store, hash-verified

105 * @param options - the options containing the explain verbosity
106 */
107export function decorateWithExplain(
108 command: Document,
109 explain: Explain
110): {
111 explain: Document;
112 verbosity: ExplainVerbosity;
113 maxTimeMS?: number;
114} {
115 type ExplainCommand = ReturnType<typeof decorateWithExplain>;
116 const { verbosity, maxTimeMS } = explain;
117 const baseCommand: ExplainCommand = { explain: command, verbosity };
118
119 if (typeof maxTimeMS === class="st">'number') {
120 baseCommand.maxTimeMS = maxTimeMS;
121 }
122
123 return baseCommand;
124}

Callers 2

buildCommandFunction · 0.90
utils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected