This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/backend/node_modules/mongodb/lib/explain.js
2024-05-26 22:54:55 +02:00

35 lines
No EOL
1.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Explain = exports.ExplainVerbosity = void 0;
const error_1 = require("./error");
/** @public */
exports.ExplainVerbosity = Object.freeze({
queryPlanner: 'queryPlanner',
queryPlannerExtended: 'queryPlannerExtended',
executionStats: 'executionStats',
allPlansExecution: 'allPlansExecution'
});
/** @internal */
class Explain {
constructor(verbosity) {
if (typeof verbosity === 'boolean') {
this.verbosity = verbosity
? exports.ExplainVerbosity.allPlansExecution
: exports.ExplainVerbosity.queryPlanner;
}
else {
this.verbosity = verbosity;
}
}
static fromOptions(options) {
if ((options === null || options === void 0 ? void 0 : options.explain) == null)
return;
const explain = options.explain;
if (typeof explain === 'boolean' || typeof explain === 'string') {
return new Explain(explain);
}
throw new error_1.MongoInvalidArgumentError('Field "explain" must be a string or a boolean');
}
}
exports.Explain = Explain;
//# sourceMappingURL=explain.js.map