@mongosh/shell-api 2.1.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abstract-cursor.js +176 -132
- package/lib/abstract-cursor.js.map +1 -1
- package/lib/aggregate-or-find-cursor.js +102 -51
- package/lib/aggregate-or-find-cursor.js.map +1 -1
- package/lib/aggregation-cursor.js +59 -13
- package/lib/aggregation-cursor.js.map +1 -1
- package/lib/bulk.js +248 -197
- package/lib/bulk.js.map +1 -1
- package/lib/change-stream-cursor.js +145 -101
- package/lib/change-stream-cursor.js.map +1 -1
- package/lib/collection.d.ts +2 -1
- package/lib/collection.js +1185 -1245
- package/lib/collection.js.map +1 -1
- package/lib/cursor.js +238 -203
- package/lib/cursor.js.map +1 -1
- package/lib/database.js +1180 -1206
- package/lib/database.js.map +1 -1
- package/lib/dbquery.js +68 -22
- package/lib/dbquery.js.map +1 -1
- package/lib/decorators.d.ts +39 -13
- package/lib/decorators.js +34 -34
- package/lib/decorators.js.map +1 -1
- package/lib/explainable-cursor.js +66 -20
- package/lib/explainable-cursor.js.map +1 -1
- package/lib/explainable.js +214 -179
- package/lib/explainable.js.map +1 -1
- package/lib/field-level-encryption.js +286 -235
- package/lib/field-level-encryption.js.map +1 -1
- package/lib/helpers.js.map +1 -1
- package/lib/interruptor.js.map +1 -1
- package/lib/log-entry.js.map +1 -1
- package/lib/mongo-errors.js.map +1 -1
- package/lib/mongo.d.ts +1 -1
- package/lib/mongo.js +582 -547
- package/lib/mongo.js.map +1 -1
- package/lib/plan-cache.js +108 -64
- package/lib/plan-cache.js.map +1 -1
- package/lib/replica-set.js +290 -277
- package/lib/replica-set.js.map +1 -1
- package/lib/result.js +228 -91
- package/lib/result.js.map +1 -1
- package/lib/run-command-cursor.js +59 -13
- package/lib/run-command-cursor.js.map +1 -1
- package/lib/session.js +123 -76
- package/lib/session.js.map +1 -1
- package/lib/shard.js +507 -514
- package/lib/shard.js.map +1 -1
- package/lib/shell-api.d.ts +1 -0
- package/lib/shell-api.js +313 -260
- package/lib/shell-api.js.map +1 -1
- package/lib/shell-bson.js.map +1 -1
- package/lib/shell-instance-state.js.map +1 -1
- package/lib/stream-processor.js +139 -92
- package/lib/stream-processor.js.map +1 -1
- package/lib/streams.js +158 -110
- package/lib/streams.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
7
39
|
};
|
|
8
40
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -12,21 +44,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
44
|
const decorators_1 = require("./decorators");
|
|
13
45
|
const cursor_1 = __importDefault(require("./cursor"));
|
|
14
46
|
const enums_1 = require("./enums");
|
|
15
|
-
let ExplainableCursor =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
let ExplainableCursor = (() => {
|
|
48
|
+
let _classDecorators = [decorators_1.shellApiClassDefault];
|
|
49
|
+
let _classDescriptor;
|
|
50
|
+
let _classExtraInitializers = [];
|
|
51
|
+
let _classThis;
|
|
52
|
+
let _classSuper = cursor_1.default;
|
|
53
|
+
var ExplainableCursor = _classThis = class extends _classSuper {
|
|
54
|
+
constructor(mongo, cursor, verbosity) {
|
|
55
|
+
super(mongo, cursor._cursor);
|
|
56
|
+
this._baseCursor = cursor;
|
|
57
|
+
this._verbosity = verbosity;
|
|
58
|
+
this._explained = null;
|
|
59
|
+
}
|
|
60
|
+
async [enums_1.asPrintable]() {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = this._explained) !== null && _a !== void 0 ? _a : (this._explained = await this._baseCursor.explain(this._verbosity));
|
|
63
|
+
return this._explained;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
__setFunctionName(_classThis, "ExplainableCursor");
|
|
67
|
+
(() => {
|
|
23
68
|
var _a;
|
|
24
|
-
(_a =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
69
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
|
|
70
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
71
|
+
ExplainableCursor = _classThis = _classDescriptor.value;
|
|
72
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
73
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
74
|
+
})();
|
|
75
|
+
return ExplainableCursor = _classThis;
|
|
76
|
+
})();
|
|
31
77
|
exports.default = ExplainableCursor;
|
|
32
78
|
//# sourceMappingURL=explainable-cursor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explainable-cursor.js","sourceRoot":"","sources":["../src/explainable-cursor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"explainable-cursor.js","sourceRoot":"","sources":["../src/explainable-cursor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,sDAA8B;AAE9B,mCAAsC;;4BAGrC,iCAAoB;;;;sBAC0B,gBAAM;8CAAd,SAAQ,WAAM;QAKnD,YAAY,KAAY,EAAE,MAAc,EAAE,SAA+B;YACvE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;YAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;QAKD,KAAK,CAAC,CAAC,mBAAW,CAAC;;YAGjB,MAAA,IAAI,CAAC,UAAU,oCAAf,IAAI,CAAC,UAAU,GAAK,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC;YACpE,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;;;;;;QApBH,6KAqBC;;;QArBoB,uDAAiB"}
|
package/lib/explainable.js
CHANGED
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
3
|
+
var useValue = arguments.length > 2;
|
|
4
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
5
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
6
|
+
}
|
|
7
|
+
return useValue ? value : void 0;
|
|
8
|
+
};
|
|
9
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
10
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
11
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
12
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
13
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
14
|
+
var _, done = false;
|
|
15
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
16
|
+
var context = {};
|
|
17
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
18
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
19
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
20
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
21
|
+
if (kind === "accessor") {
|
|
22
|
+
if (result === void 0) continue;
|
|
23
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
24
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
25
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
26
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27
|
+
}
|
|
28
|
+
else if (_ = accept(result)) {
|
|
29
|
+
if (kind === "field") initializers.unshift(_);
|
|
30
|
+
else descriptor[key] = _;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
34
|
+
done = true;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
7
39
|
};
|
|
8
40
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -13,180 +45,183 @@ const explainable_cursor_1 = __importDefault(require("./explainable-cursor"));
|
|
|
13
45
|
const decorators_1 = require("./decorators");
|
|
14
46
|
const enums_1 = require("./enums");
|
|
15
47
|
const helpers_1 = require("./helpers");
|
|
16
|
-
let Explainable =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
let Explainable = (() => {
|
|
49
|
+
let _classDecorators = [decorators_1.shellApiClassDefault];
|
|
50
|
+
let _classDescriptor;
|
|
51
|
+
let _classExtraInitializers = [];
|
|
52
|
+
let _classThis;
|
|
53
|
+
let _classSuper = decorators_1.ShellApiWithMongoClass;
|
|
54
|
+
let _instanceExtraInitializers = [];
|
|
55
|
+
let _find_decorators;
|
|
56
|
+
let _aggregate_decorators;
|
|
57
|
+
let _count_decorators;
|
|
58
|
+
let _distinct_decorators;
|
|
59
|
+
let _findAndModify_decorators;
|
|
60
|
+
let _findOneAndDelete_decorators;
|
|
61
|
+
let _findOneAndReplace_decorators;
|
|
62
|
+
let _findOneAndUpdate_decorators;
|
|
63
|
+
let _remove_decorators;
|
|
64
|
+
let _update_decorators;
|
|
65
|
+
let _mapReduce_decorators;
|
|
66
|
+
var Explainable = _classThis = class extends _classSuper {
|
|
67
|
+
constructor(mongo, collection, verbosity) {
|
|
68
|
+
super();
|
|
69
|
+
this._mongo = (__runInitializers(this, _instanceExtraInitializers), void 0);
|
|
70
|
+
this._mongo = mongo;
|
|
71
|
+
this._collection = collection;
|
|
72
|
+
this._verbosity = verbosity;
|
|
73
|
+
}
|
|
74
|
+
[enums_1.asPrintable]() {
|
|
75
|
+
return `Explainable(${this._collection.getFullName()})`;
|
|
76
|
+
}
|
|
77
|
+
_emitExplainableApiCall(methodName, methodArguments = {}) {
|
|
78
|
+
this._mongo._instanceState.emitApiCallWithArgs({
|
|
79
|
+
method: methodName,
|
|
80
|
+
class: 'Explainable',
|
|
81
|
+
db: this._collection._database._name,
|
|
82
|
+
coll: this._collection._name,
|
|
83
|
+
arguments: methodArguments,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getCollection() {
|
|
87
|
+
this._emitExplainableApiCall('getCollection');
|
|
88
|
+
return this._collection;
|
|
89
|
+
}
|
|
90
|
+
getVerbosity() {
|
|
91
|
+
this._emitExplainableApiCall('getVerbosity');
|
|
92
|
+
return this._verbosity;
|
|
93
|
+
}
|
|
94
|
+
setVerbosity(verbosity) {
|
|
95
|
+
verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
|
|
96
|
+
this._emitExplainableApiCall('setVerbosity', { verbosity });
|
|
97
|
+
this._verbosity = verbosity;
|
|
98
|
+
}
|
|
99
|
+
async find(query, projection) {
|
|
100
|
+
this._emitExplainableApiCall('find', { query, projection });
|
|
101
|
+
const cursor = await this._collection.find(query, projection);
|
|
102
|
+
return new explainable_cursor_1.default(this._mongo, cursor, this._verbosity);
|
|
103
|
+
}
|
|
104
|
+
async aggregate(...args) {
|
|
105
|
+
var _a;
|
|
106
|
+
this._emitExplainableApiCall('aggregate', { args });
|
|
107
|
+
let options;
|
|
108
|
+
let pipeline;
|
|
109
|
+
if (Array.isArray(args[0])) {
|
|
110
|
+
pipeline = args[0];
|
|
111
|
+
options = (_a = args[1]) !== null && _a !== void 0 ? _a : {};
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
pipeline = args;
|
|
115
|
+
options = {};
|
|
116
|
+
}
|
|
117
|
+
return await this._collection.aggregate(pipeline, {
|
|
77
118
|
...options,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
186
|
-
(0, decorators_1.apiVersions)([])
|
|
187
|
-
], Explainable.prototype, "mapReduce", null);
|
|
188
|
-
Explainable = __decorate([
|
|
189
|
-
decorators_1.shellApiClassDefault
|
|
190
|
-
], Explainable);
|
|
119
|
+
explain: this._verbosity,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async count(query = {}, options = {}) {
|
|
123
|
+
this._emitExplainableApiCall('count', { query, options });
|
|
124
|
+
return (0, helpers_1.markAsExplainOutput)(await this._collection._database._runReadCommand({
|
|
125
|
+
explain: {
|
|
126
|
+
count: `${this._collection._name}`,
|
|
127
|
+
query,
|
|
128
|
+
...options,
|
|
129
|
+
},
|
|
130
|
+
verbosity: this._verbosity,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
async distinct(field, query, options = {}) {
|
|
134
|
+
this._emitExplainableApiCall('distinct', { field, query, options });
|
|
135
|
+
return this._collection.distinct(field, query !== null && query !== void 0 ? query : {}, {
|
|
136
|
+
...options,
|
|
137
|
+
explain: this._verbosity,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async findAndModify(options) {
|
|
141
|
+
this._emitExplainableApiCall('findAndModify', { options });
|
|
142
|
+
return this._collection.findAndModify({
|
|
143
|
+
...options,
|
|
144
|
+
explain: this._verbosity,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async findOneAndDelete(filter, options = {}) {
|
|
148
|
+
this._emitExplainableApiCall('findOneAndDelete', { filter, options });
|
|
149
|
+
return this._collection.findOneAndDelete(filter, {
|
|
150
|
+
...options,
|
|
151
|
+
explain: this._verbosity,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async findOneAndReplace(filter, replacement, options = {}) {
|
|
155
|
+
this._emitExplainableApiCall('findOneAndReplace', { filter, options });
|
|
156
|
+
return this._collection.findOneAndReplace(filter, replacement, {
|
|
157
|
+
...options,
|
|
158
|
+
explain: this._verbosity,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async findOneAndUpdate(filter, update, options = {}) {
|
|
162
|
+
this._emitExplainableApiCall('findOneAndUpdate', { filter, options });
|
|
163
|
+
return this._collection.findOneAndUpdate(filter, update, {
|
|
164
|
+
...options,
|
|
165
|
+
explain: this._verbosity,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async remove(query, options = {}) {
|
|
169
|
+
this._emitExplainableApiCall('remove', { query, options });
|
|
170
|
+
options = { ...(0, helpers_1.processRemoveOptions)(options), explain: this._verbosity };
|
|
171
|
+
return this._collection.remove(query, options);
|
|
172
|
+
}
|
|
173
|
+
async update(filter, update, options = {}) {
|
|
174
|
+
this._emitExplainableApiCall('update', { filter, update, options });
|
|
175
|
+
return this._collection.update(filter, update, {
|
|
176
|
+
...options,
|
|
177
|
+
explain: this._verbosity,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async mapReduce(map, reduce, optionsOrOutString) {
|
|
181
|
+
this._emitExplainableApiCall('mapReduce', {
|
|
182
|
+
map,
|
|
183
|
+
reduce,
|
|
184
|
+
optionsOrOutString,
|
|
185
|
+
});
|
|
186
|
+
const options = {
|
|
187
|
+
...(0, helpers_1.processMapReduceOptions)(optionsOrOutString),
|
|
188
|
+
explain: this._verbosity,
|
|
189
|
+
};
|
|
190
|
+
return this._collection.mapReduce(map, reduce, options);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
__setFunctionName(_classThis, "Explainable");
|
|
194
|
+
(() => {
|
|
195
|
+
var _a;
|
|
196
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
|
|
197
|
+
_find_decorators = [(0, decorators_1.returnType)('ExplainableCursor'), (0, decorators_1.apiVersions)([1]), decorators_1.returnsPromise];
|
|
198
|
+
_aggregate_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
199
|
+
_count_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
200
|
+
_distinct_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
201
|
+
_findAndModify_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
202
|
+
_findOneAndDelete_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
203
|
+
_findOneAndReplace_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
204
|
+
_findOneAndUpdate_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
205
|
+
_remove_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
206
|
+
_update_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
207
|
+
_mapReduce_decorators = [decorators_1.returnsPromise, (0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]), (0, decorators_1.apiVersions)([])];
|
|
208
|
+
__esDecorate(_classThis, null, _find_decorators, { kind: "method", name: "find", static: false, private: false, access: { has: obj => "find" in obj, get: obj => obj.find }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
209
|
+
__esDecorate(_classThis, null, _aggregate_decorators, { kind: "method", name: "aggregate", static: false, private: false, access: { has: obj => "aggregate" in obj, get: obj => obj.aggregate }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
210
|
+
__esDecorate(_classThis, null, _count_decorators, { kind: "method", name: "count", static: false, private: false, access: { has: obj => "count" in obj, get: obj => obj.count }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
211
|
+
__esDecorate(_classThis, null, _distinct_decorators, { kind: "method", name: "distinct", static: false, private: false, access: { has: obj => "distinct" in obj, get: obj => obj.distinct }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
212
|
+
__esDecorate(_classThis, null, _findAndModify_decorators, { kind: "method", name: "findAndModify", static: false, private: false, access: { has: obj => "findAndModify" in obj, get: obj => obj.findAndModify }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
213
|
+
__esDecorate(_classThis, null, _findOneAndDelete_decorators, { kind: "method", name: "findOneAndDelete", static: false, private: false, access: { has: obj => "findOneAndDelete" in obj, get: obj => obj.findOneAndDelete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
214
|
+
__esDecorate(_classThis, null, _findOneAndReplace_decorators, { kind: "method", name: "findOneAndReplace", static: false, private: false, access: { has: obj => "findOneAndReplace" in obj, get: obj => obj.findOneAndReplace }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
215
|
+
__esDecorate(_classThis, null, _findOneAndUpdate_decorators, { kind: "method", name: "findOneAndUpdate", static: false, private: false, access: { has: obj => "findOneAndUpdate" in obj, get: obj => obj.findOneAndUpdate }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
216
|
+
__esDecorate(_classThis, null, _remove_decorators, { kind: "method", name: "remove", static: false, private: false, access: { has: obj => "remove" in obj, get: obj => obj.remove }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
217
|
+
__esDecorate(_classThis, null, _update_decorators, { kind: "method", name: "update", static: false, private: false, access: { has: obj => "update" in obj, get: obj => obj.update }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
218
|
+
__esDecorate(_classThis, null, _mapReduce_decorators, { kind: "method", name: "mapReduce", static: false, private: false, access: { has: obj => "mapReduce" in obj, get: obj => obj.mapReduce }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
219
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
220
|
+
Explainable = _classThis = _classDescriptor.value;
|
|
221
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
222
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
223
|
+
})();
|
|
224
|
+
return Explainable = _classThis;
|
|
225
|
+
})();
|
|
191
226
|
exports.default = Explainable;
|
|
192
227
|
//# sourceMappingURL=explainable.js.map
|
package/lib/explainable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explainable.js","sourceRoot":"","sources":["../src/explainable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"explainable.js","sourceRoot":"","sources":["../src/explainable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,8EAAqD;AACrD,6CAOsB;AACtB,mCAAsD;AAOtD,uCAKmB;;4BAYlB,iCAAoB;;;;sBACoB,mCAAsB;;;;;;;;;;;;;wCAA9B,SAAQ,WAAsB;QAI7D,YACE,KAAY,EACZ,UAAsB,EACtB,SAA+B;YAE/B,KAAK,EAAE,CAAC;YARV,WAAM,iEAAQ;YASZ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;QAKD,CAAC,mBAAW,CAAC;YACX,OAAO,eAAe,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,CAAC;QAC1D,CAAC;QASO,uBAAuB,CAC7B,UAAkB,EAClB,kBAA4B,EAAE;YAE9B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC;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