@mongosh/shell-api 1.2.3 → 1.4.1
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.d.ts +1 -1
- package/lib/abstract-cursor.js +14 -14
- package/lib/abstract-cursor.js.map +1 -1
- package/lib/bulk.js +31 -31
- package/lib/bulk.js.map +1 -1
- package/lib/change-stream-cursor.js +2 -2
- package/lib/change-stream-cursor.js.map +1 -1
- package/lib/collection.d.ts +3 -3
- package/lib/collection.js +183 -164
- package/lib/collection.js.map +1 -1
- package/lib/cursor.js +28 -28
- package/lib/cursor.js.map +1 -1
- package/lib/database.d.ts +2 -2
- package/lib/database.js +127 -124
- package/lib/database.js.map +1 -1
- package/lib/decorators.js +5 -5
- package/lib/decorators.js.map +1 -1
- package/lib/explainable.js +17 -17
- package/lib/explainable.js.map +1 -1
- package/lib/field-level-encryption.d.ts +11 -5
- package/lib/field-level-encryption.js +52 -29
- package/lib/field-level-encryption.js.map +1 -1
- package/lib/helpers.js +22 -2
- package/lib/helpers.js.map +1 -1
- package/lib/mongo.d.ts +7 -6
- package/lib/mongo.js +88 -58
- package/lib/mongo.js.map +1 -1
- package/lib/plan-cache.js +4 -4
- package/lib/plan-cache.js.map +1 -1
- package/lib/replica-set.js +25 -25
- package/lib/replica-set.js.map +1 -1
- package/lib/session.js +4 -4
- package/lib/session.js.map +1 -1
- package/lib/shard.js +81 -81
- package/lib/shard.js.map +1 -1
- package/lib/shell-api.js +24 -24
- package/lib/shell-api.js.map +1 -1
- package/lib/shell-bson.js +13 -13
- package/lib/shell-bson.js.map +1 -1
- package/lib/shell-instance-state.d.ts +1 -1
- package/lib/shell-instance-state.js +8 -8
- package/lib/shell-instance-state.js.map +1 -1
- package/package.json +8 -7
package/lib/collection.js
CHANGED
|
@@ -32,7 +32,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
32
32
|
}
|
|
33
33
|
if (typeof prop !== 'string' ||
|
|
34
34
|
prop.startsWith('_') ||
|
|
35
|
-
!helpers_1.isValidCollectionName(prop)) {
|
|
35
|
+
!(0, helpers_1.isValidCollectionName)(prop)) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
return database.getCollection(`${name}.${prop}`);
|
|
@@ -67,13 +67,13 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
67
67
|
pipeline = args || [];
|
|
68
68
|
}
|
|
69
69
|
this._emitCollectionApiCall('aggregate', { options, pipeline });
|
|
70
|
-
const { aggOptions, dbOptions, explain } = helpers_1.adaptAggregateOptions(options);
|
|
70
|
+
const { aggOptions, dbOptions, explain } = (0, helpers_1.adaptAggregateOptions)(options);
|
|
71
71
|
const providerCursor = this._mongo._serviceProvider.aggregate(this._database._name, this._name, pipeline, { ...await this._database._baseOptions(), ...aggOptions }, dbOptions);
|
|
72
72
|
const cursor = new index_1.AggregationCursor(this._mongo, providerCursor);
|
|
73
73
|
if (explain) {
|
|
74
74
|
return await cursor.explain(explain);
|
|
75
75
|
}
|
|
76
|
-
else if (helpers_1.shouldRunAggregationImmediately(pipeline)) {
|
|
76
|
+
else if ((0, helpers_1.shouldRunAggregationImmediately)(pipeline)) {
|
|
77
77
|
await cursor.hasNext();
|
|
78
78
|
}
|
|
79
79
|
this._mongo._instanceState.currentCursor = cursor;
|
|
@@ -94,26 +94,26 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
94
94
|
return this._mongo._serviceProvider.countDocuments(this._database._name, this._name, query, { ...await this._database._baseOptions(), ...options });
|
|
95
95
|
}
|
|
96
96
|
async deleteMany(filter, options = {}) {
|
|
97
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.deleteMany');
|
|
97
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.deleteMany');
|
|
98
98
|
this._emitCollectionApiCall('deleteMany', { filter, options });
|
|
99
99
|
const result = await this._mongo._serviceProvider.deleteMany(this._database._name, this._name, filter, { ...await this._database._baseOptions(), ...options });
|
|
100
100
|
if (options.explain) {
|
|
101
|
-
return helpers_1.markAsExplainOutput(result);
|
|
101
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
102
102
|
}
|
|
103
103
|
return new index_1.DeleteResult(!!result.acknowledged, result.deletedCount);
|
|
104
104
|
}
|
|
105
105
|
async deleteOne(filter, options = {}) {
|
|
106
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.deleteOne');
|
|
106
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.deleteOne');
|
|
107
107
|
this._emitCollectionApiCall('deleteOne', { filter, options });
|
|
108
108
|
const result = await this._mongo._serviceProvider.deleteOne(this._database._name, this._name, filter, { ...await this._database._baseOptions(), ...options });
|
|
109
109
|
if (options.explain) {
|
|
110
|
-
return helpers_1.markAsExplainOutput(result);
|
|
110
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
111
111
|
}
|
|
112
112
|
return new index_1.DeleteResult(!!result.acknowledged, result.deletedCount);
|
|
113
113
|
}
|
|
114
114
|
async distinct(field, query, options = {}) {
|
|
115
115
|
this._emitCollectionApiCall('distinct', { field, query, options });
|
|
116
|
-
return helpers_1.maybeMarkAsExplainOutput(await this._mongo._serviceProvider.distinct(this._database._name, this._name, field, query, { ...await this._database._baseOptions(), ...options }), options);
|
|
116
|
+
return (0, helpers_1.maybeMarkAsExplainOutput)(await this._mongo._serviceProvider.distinct(this._database._name, this._name, field, query, { ...await this._database._baseOptions(), ...options }), options);
|
|
117
117
|
}
|
|
118
118
|
async estimatedDocumentCount(options = {}) {
|
|
119
119
|
this._emitCollectionApiCall('estimatedDocumentCount', { options });
|
|
@@ -129,8 +129,8 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
129
129
|
return cursor;
|
|
130
130
|
}
|
|
131
131
|
async findAndModify(options) {
|
|
132
|
-
helpers_1.assertArgsDefinedType([options], [true], 'Collection.findAndModify');
|
|
133
|
-
helpers_1.assertKeysDefined(options, ['query']);
|
|
132
|
+
(0, helpers_1.assertArgsDefinedType)([options], [true], 'Collection.findAndModify');
|
|
133
|
+
(0, helpers_1.assertKeysDefined)(options, ['query']);
|
|
134
134
|
this._emitCollectionApiCall('findAndModify', { options: { ...options, update: !!options.update } });
|
|
135
135
|
const reducedOptions = { ...options };
|
|
136
136
|
delete reducedOptions.query;
|
|
@@ -155,7 +155,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
155
155
|
return new index_1.Cursor(this._mongo, this._mongo._serviceProvider.find(this._database._name, this._name, query, { ...await this._database._baseOptions(), ...options })).limit(1).tryNext();
|
|
156
156
|
}
|
|
157
157
|
async renameCollection(newName, dropTarget) {
|
|
158
|
-
helpers_1.assertArgsDefinedType([newName], ['string'], 'Collection.renameCollection');
|
|
158
|
+
(0, helpers_1.assertArgsDefinedType)([newName], ['string'], 'Collection.renameCollection');
|
|
159
159
|
this._emitCollectionApiCall('renameCollection', { newName, dropTarget });
|
|
160
160
|
try {
|
|
161
161
|
await this._mongo._serviceProvider.renameCollection(this._database._name, this._name, newName, { ...await this._database._baseOptions(), dropTarget: !!dropTarget });
|
|
@@ -164,7 +164,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
catch (e) {
|
|
167
|
-
if (e.name === 'MongoError') {
|
|
167
|
+
if ((e === null || e === void 0 ? void 0 : e.name) === 'MongoError') {
|
|
168
168
|
return {
|
|
169
169
|
ok: 0,
|
|
170
170
|
errmsg: e.errmsg,
|
|
@@ -176,90 +176,92 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
async findOneAndDelete(filter, options = {}) {
|
|
179
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.findOneAndDelete');
|
|
179
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.findOneAndDelete');
|
|
180
180
|
this._emitCollectionApiCall('findOneAndDelete', { filter, options });
|
|
181
181
|
const result = await this._mongo._serviceProvider.findOneAndDelete(this._database._name, this._name, filter, { ...await this._database._baseOptions(), ...options });
|
|
182
182
|
if (options.explain) {
|
|
183
|
-
return helpers_1.markAsExplainOutput(result);
|
|
183
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
184
184
|
}
|
|
185
185
|
return result.value;
|
|
186
186
|
}
|
|
187
187
|
async findOneAndReplace(filter, replacement, options = {}) {
|
|
188
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.findOneAndReplace');
|
|
189
|
-
const findOneAndReplaceOptions = helpers_1.processFindAndModifyOptions({
|
|
188
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.findOneAndReplace');
|
|
189
|
+
const findOneAndReplaceOptions = (0, helpers_1.processFindAndModifyOptions)({
|
|
190
190
|
...await this._database._baseOptions(),
|
|
191
191
|
...options
|
|
192
192
|
});
|
|
193
193
|
this._emitCollectionApiCall('findOneAndReplace', { filter, findOneAndReplaceOptions });
|
|
194
194
|
const result = await this._mongo._serviceProvider.findOneAndReplace(this._database._name, this._name, filter, replacement, findOneAndReplaceOptions);
|
|
195
195
|
if (options.explain) {
|
|
196
|
-
return helpers_1.markAsExplainOutput(result);
|
|
196
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
197
197
|
}
|
|
198
198
|
return result.value;
|
|
199
199
|
}
|
|
200
200
|
async findOneAndUpdate(filter, update, options = {}) {
|
|
201
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.findOneAndUpdate');
|
|
202
|
-
const findOneAndUpdateOptions = helpers_1.processFindAndModifyOptions({
|
|
201
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.findOneAndUpdate');
|
|
202
|
+
const findOneAndUpdateOptions = (0, helpers_1.processFindAndModifyOptions)({
|
|
203
203
|
...await this._database._baseOptions(),
|
|
204
204
|
...options
|
|
205
205
|
});
|
|
206
206
|
this._emitCollectionApiCall('findOneAndUpdate', { filter, findOneAndUpdateOptions });
|
|
207
207
|
const result = await this._mongo._serviceProvider.findOneAndUpdate(this._database._name, this._name, filter, update, findOneAndUpdateOptions);
|
|
208
208
|
if (options.explain) {
|
|
209
|
-
return helpers_1.markAsExplainOutput(result);
|
|
209
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
210
210
|
}
|
|
211
211
|
return result.value;
|
|
212
212
|
}
|
|
213
213
|
async insert(docs, options = {}) {
|
|
214
214
|
await this._instanceState.printDeprecationWarning('Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.');
|
|
215
|
-
helpers_1.assertArgsDefinedType([docs], [true], 'Collection.insert');
|
|
215
|
+
(0, helpers_1.assertArgsDefinedType)([docs], [true], 'Collection.insert');
|
|
216
216
|
const docsToInsert = Array.isArray(docs) ? docs.map((doc) => ({ ...doc })) : [{ ...docs }];
|
|
217
217
|
this._emitCollectionApiCall('insert', { options });
|
|
218
218
|
const result = await this._mongo._serviceProvider.insertMany(this._database._name, this._name, docsToInsert, { ...await this._database._baseOptions(), ...options });
|
|
219
219
|
return new index_1.InsertManyResult(!!result.acknowledged, result.insertedIds);
|
|
220
220
|
}
|
|
221
221
|
async insertMany(docs, options = {}) {
|
|
222
|
-
helpers_1.assertArgsDefinedType([docs], [true], 'Collection.insertMany');
|
|
222
|
+
(0, helpers_1.assertArgsDefinedType)([docs], [true], 'Collection.insertMany');
|
|
223
223
|
const docsToInsert = Array.isArray(docs) ? docs.map((doc) => ({ ...doc })) : docs;
|
|
224
224
|
this._emitCollectionApiCall('insertMany', { options });
|
|
225
225
|
const result = await this._mongo._serviceProvider.insertMany(this._database._name, this._name, docsToInsert, { ...await this._database._baseOptions(), ...options });
|
|
226
226
|
return new index_1.InsertManyResult(!!result.acknowledged, result.insertedIds);
|
|
227
227
|
}
|
|
228
228
|
async insertOne(doc, options = {}) {
|
|
229
|
-
helpers_1.assertArgsDefinedType([doc], [true], 'Collection.insertOne');
|
|
229
|
+
(0, helpers_1.assertArgsDefinedType)([doc], [true], 'Collection.insertOne');
|
|
230
230
|
this._emitCollectionApiCall('insertOne', { options });
|
|
231
231
|
const result = await this._mongo._serviceProvider.insertOne(this._database._name, this._name, { ...doc }, { ...await this._database._baseOptions(), ...options });
|
|
232
232
|
return new index_1.InsertOneResult(!!result.acknowledged, result.insertedId);
|
|
233
233
|
}
|
|
234
234
|
async isCapped() {
|
|
235
|
+
var _a, _b;
|
|
235
236
|
this._emitCollectionApiCall('isCapped');
|
|
236
|
-
|
|
237
|
+
const colls = await this._database._listCollections({ name: this._name }, { nameOnly: false });
|
|
238
|
+
if (colls.length === 0) {
|
|
239
|
+
throw new errors_1.MongoshRuntimeError(`collection ${this.getFullName()} not found`);
|
|
240
|
+
}
|
|
241
|
+
return !!((_b = (_a = colls[0]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.capped);
|
|
237
242
|
}
|
|
238
243
|
async remove(query, options = {}) {
|
|
239
244
|
await this._instanceState.printDeprecationWarning('Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.');
|
|
240
|
-
helpers_1.assertArgsDefinedType([query], [true], 'Collection.remove');
|
|
241
|
-
const removeOptions = helpers_1.processRemoveOptions(options);
|
|
245
|
+
(0, helpers_1.assertArgsDefinedType)([query], [true], 'Collection.remove');
|
|
246
|
+
const removeOptions = (0, helpers_1.processRemoveOptions)(options);
|
|
242
247
|
const method = removeOptions.justOne ? 'deleteOne' : 'deleteMany';
|
|
243
248
|
delete removeOptions.justOne;
|
|
244
249
|
this._emitCollectionApiCall('remove', { query, removeOptions });
|
|
245
250
|
const result = await this._mongo._serviceProvider[method](this._database._name, this._name, query, { ...await this._database._baseOptions(), ...removeOptions });
|
|
246
251
|
if (removeOptions.explain) {
|
|
247
|
-
return helpers_1.markAsExplainOutput(result);
|
|
252
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
248
253
|
}
|
|
249
254
|
return new index_1.DeleteResult(!!result.acknowledged, result.deletedCount);
|
|
250
255
|
}
|
|
251
|
-
save() {
|
|
252
|
-
throw new errors_1.MongoshInvalidInputError('Collection.save() is deprecated. Use insertOne, insertMany, updateOne, or updateMany.');
|
|
253
|
-
}
|
|
254
256
|
async replaceOne(filter, replacement, options = {}) {
|
|
255
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.replaceOne');
|
|
257
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.replaceOne');
|
|
256
258
|
this._emitCollectionApiCall('replaceOne', { filter, options });
|
|
257
259
|
const result = await this._mongo._serviceProvider.replaceOne(this._database._name, this._name, filter, replacement, { ...await this._database._baseOptions(), ...options });
|
|
258
260
|
return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
|
|
259
261
|
}
|
|
260
262
|
async update(filter, update, options = {}) {
|
|
261
263
|
await this._instanceState.printDeprecationWarning('Collection.update() is deprecated. Use updateOne, updateMany, or bulkWrite.');
|
|
262
|
-
helpers_1.assertArgsDefinedType([filter, update], [true, true], 'Collection.update');
|
|
264
|
+
(0, helpers_1.assertArgsDefinedType)([filter, update], [true, true], 'Collection.update');
|
|
263
265
|
this._emitCollectionApiCall('update', { filter, options });
|
|
264
266
|
let result;
|
|
265
267
|
if (options.multi) {
|
|
@@ -269,25 +271,25 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
269
271
|
result = await this._mongo._serviceProvider.updateOne(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
|
|
270
272
|
}
|
|
271
273
|
if (options.explain) {
|
|
272
|
-
return helpers_1.markAsExplainOutput(result);
|
|
274
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
273
275
|
}
|
|
274
276
|
return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
|
|
275
277
|
}
|
|
276
278
|
async updateMany(filter, update, options = {}) {
|
|
277
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.updateMany');
|
|
279
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.updateMany');
|
|
278
280
|
this._emitCollectionApiCall('updateMany', { filter, options });
|
|
279
281
|
const result = await this._mongo._serviceProvider.updateMany(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
|
|
280
282
|
if (options.explain) {
|
|
281
|
-
return helpers_1.markAsExplainOutput(result);
|
|
283
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
282
284
|
}
|
|
283
285
|
return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
|
|
284
286
|
}
|
|
285
287
|
async updateOne(filter, update, options = {}) {
|
|
286
|
-
helpers_1.assertArgsDefinedType([filter], [true], 'Collection.updateOne');
|
|
288
|
+
(0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.updateOne');
|
|
287
289
|
this._emitCollectionApiCall('updateOne', { filter, options });
|
|
288
290
|
const result = await this._mongo._serviceProvider.updateOne(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
|
|
289
291
|
if (options.explain) {
|
|
290
|
-
return helpers_1.markAsExplainOutput(result);
|
|
292
|
+
return (0, helpers_1.markAsExplainOutput)(result);
|
|
291
293
|
}
|
|
292
294
|
return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
|
|
293
295
|
}
|
|
@@ -299,7 +301,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
299
301
|
});
|
|
300
302
|
}
|
|
301
303
|
async _createIndexes(keyPatterns, options = {}, commitQuorum) {
|
|
302
|
-
helpers_1.assertArgsDefinedType([keyPatterns], [true], 'Collection.createIndexes');
|
|
304
|
+
(0, helpers_1.assertArgsDefinedType)([keyPatterns], [true], 'Collection.createIndexes');
|
|
303
305
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
304
306
|
throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
|
|
305
307
|
}
|
|
@@ -320,7 +322,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
320
322
|
return this._createIndexes(keyPatterns, options, commitQuorum);
|
|
321
323
|
}
|
|
322
324
|
async createIndex(keys, options = {}, commitQuorum) {
|
|
323
|
-
helpers_1.assertArgsDefinedType([keys], [true], 'Collection.createIndex');
|
|
325
|
+
(0, helpers_1.assertArgsDefinedType)([keys], [true], 'Collection.createIndex');
|
|
324
326
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
325
327
|
throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
|
|
326
328
|
}
|
|
@@ -361,8 +363,8 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
catch (error) {
|
|
364
|
-
if ((error.codeName === 'IndexNotFound' || error.codeName === undefined) &&
|
|
365
|
-
(error.errmsg === 'invalid index name spec' || error.errmsg === undefined) &&
|
|
366
|
+
if (((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound' || (error === null || error === void 0 ? void 0 : error.codeName) === undefined) &&
|
|
367
|
+
((error === null || error === void 0 ? void 0 : error.errmsg) === 'invalid index name spec' || (error === null || error === void 0 ? void 0 : error.errmsg) === undefined) &&
|
|
366
368
|
Array.isArray(indexes) &&
|
|
367
369
|
indexes.length > 0 &&
|
|
368
370
|
(await this._database.version()).match(/^4\.0\./)) {
|
|
@@ -372,7 +374,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
372
374
|
return errored;
|
|
373
375
|
return all.sort((a, b) => b.nIndexesWas - a.nIndexesWas)[0];
|
|
374
376
|
}
|
|
375
|
-
if (error.codeName === 'IndexNotFound') {
|
|
377
|
+
if ((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound') {
|
|
376
378
|
return {
|
|
377
379
|
ok: error.ok,
|
|
378
380
|
errmsg: error.errmsg,
|
|
@@ -384,7 +386,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
384
386
|
}
|
|
385
387
|
}
|
|
386
388
|
async dropIndex(index) {
|
|
387
|
-
helpers_1.assertArgsDefinedType([index], [true], 'Collection.dropIndex');
|
|
389
|
+
(0, helpers_1.assertArgsDefinedType)([index], [true], 'Collection.dropIndex');
|
|
388
390
|
this._emitCollectionApiCall('dropIndex', { index });
|
|
389
391
|
if (index === '*') {
|
|
390
392
|
throw new errors_1.MongoshInvalidInputError('To drop indexes in the collection using \'*\', use db.collection.dropIndexes().', errors_1.CommonErrors.InvalidArgument);
|
|
@@ -394,13 +396,20 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
394
396
|
}
|
|
395
397
|
return this.dropIndexes(index);
|
|
396
398
|
}
|
|
399
|
+
async _getSingleStorageStatValue(key) {
|
|
400
|
+
const cursor = await this.aggregate([
|
|
401
|
+
{ $collStats: { storageStats: {} } },
|
|
402
|
+
{ $group: { _id: null, value: { $sum: `$storageStats.${key}` } } }
|
|
403
|
+
]);
|
|
404
|
+
const [{ value }] = await cursor.toArray();
|
|
405
|
+
return value;
|
|
406
|
+
}
|
|
397
407
|
async totalIndexSize(...args) {
|
|
398
408
|
this._emitCollectionApiCall('totalIndexSize');
|
|
399
409
|
if (args.length) {
|
|
400
410
|
throw new errors_1.MongoshInvalidInputError('"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.', errors_1.CommonErrors.InvalidArgument);
|
|
401
411
|
}
|
|
402
|
-
|
|
403
|
-
return stats.totalIndexSize;
|
|
412
|
+
return this._getSingleStorageStatValue('totalIndexSize');
|
|
404
413
|
}
|
|
405
414
|
async reIndex() {
|
|
406
415
|
this._emitCollectionApiCall('reIndex');
|
|
@@ -418,26 +427,40 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
418
427
|
}
|
|
419
428
|
async dataSize() {
|
|
420
429
|
this._emitCollectionApiCall('dataSize');
|
|
421
|
-
|
|
422
|
-
return stats.size;
|
|
430
|
+
return this._getSingleStorageStatValue('size');
|
|
423
431
|
}
|
|
424
432
|
async storageSize() {
|
|
425
433
|
this._emitCollectionApiCall('storageSize');
|
|
426
|
-
|
|
427
|
-
return stats.storageSize;
|
|
434
|
+
return this._getSingleStorageStatValue('storageSize');
|
|
428
435
|
}
|
|
429
436
|
async totalSize() {
|
|
430
437
|
this._emitCollectionApiCall('totalSize');
|
|
431
|
-
|
|
432
|
-
return (Number(stats.storageSize) || 0) + (Number(stats.totalIndexSize) || 0);
|
|
438
|
+
return this._getSingleStorageStatValue('totalSize');
|
|
433
439
|
}
|
|
434
|
-
async drop() {
|
|
440
|
+
async drop(options = {}) {
|
|
441
|
+
var _a, _b, _c;
|
|
435
442
|
this._emitCollectionApiCall('drop');
|
|
443
|
+
let encryptedFieldsOptions = {};
|
|
444
|
+
const encryptedFieldsMap = (_a = this._mongo._fleOptions) === null || _a === void 0 ? void 0 : _a.encryptedFieldsMap;
|
|
445
|
+
const encryptedFields = encryptedFieldsMap === null || encryptedFieldsMap === void 0 ? void 0 : encryptedFieldsMap[`${this._database._name}.${this._name}`];
|
|
446
|
+
if (!encryptedFields && !options.encryptedFields) {
|
|
447
|
+
try {
|
|
448
|
+
const collectionInfos = await this._mongo._serviceProvider.listCollections(this._database._name, {
|
|
449
|
+
name: this._name
|
|
450
|
+
}, await this._database._baseOptions());
|
|
451
|
+
const encryptedFields = (_c = (_b = collectionInfos === null || collectionInfos === void 0 ? void 0 : collectionInfos[0]) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.encryptedFields;
|
|
452
|
+
if (encryptedFields) {
|
|
453
|
+
encryptedFieldsOptions = { encryptedFields };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
436
459
|
try {
|
|
437
|
-
return await this._mongo._serviceProvider.dropCollection(this._database._name, this._name, await this._database._baseOptions());
|
|
460
|
+
return await this._mongo._serviceProvider.dropCollection(this._database._name, this._name, { ...await this._database._baseOptions(), ...options, ...encryptedFieldsOptions });
|
|
438
461
|
}
|
|
439
462
|
catch (error) {
|
|
440
|
-
if (error.codeName === 'NamespaceNotFound') {
|
|
463
|
+
if ((error === null || error === void 0 ? void 0 : error.codeName) === 'NamespaceNotFound') {
|
|
441
464
|
this._mongo._instanceState.messageBus.emit('mongosh:warn', {
|
|
442
465
|
method: 'drop',
|
|
443
466
|
class: 'Collection',
|
|
@@ -464,7 +487,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
464
487
|
return `${this._name}`;
|
|
465
488
|
}
|
|
466
489
|
async runCommand(commandName, options) {
|
|
467
|
-
helpers_1.assertArgsDefinedType([commandName], [['string', 'object']], 'Collection.runCommand');
|
|
490
|
+
(0, helpers_1.assertArgsDefinedType)([commandName], [['string', 'object']], 'Collection.runCommand');
|
|
468
491
|
if (options) {
|
|
469
492
|
if (typeof commandName !== 'string') {
|
|
470
493
|
throw new errors_1.MongoshInvalidInputError('Collection.runCommand takes a command string as its first arugment', errors_1.CommonErrors.InvalidArgument);
|
|
@@ -484,7 +507,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
484
507
|
return await this._database._runCommand(cmd);
|
|
485
508
|
}
|
|
486
509
|
explain(verbosity = 'queryPlanner') {
|
|
487
|
-
verbosity = helpers_1.validateExplainableVerbosity(verbosity);
|
|
510
|
+
verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
|
|
488
511
|
this._emitCollectionApiCall('explain', { verbosity });
|
|
489
512
|
return new index_1.Explainable(this._mongo, this, verbosity);
|
|
490
513
|
}
|
|
@@ -544,9 +567,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
544
567
|
}
|
|
545
568
|
async latencyStats(options = {}) {
|
|
546
569
|
this._emitCollectionApiCall('latencyStats', { options });
|
|
547
|
-
|
|
548
|
-
const providerCursor = this._mongo._serviceProvider.aggregate(this._database._name, this._name, pipeline, await this._database._baseOptions());
|
|
549
|
-
return await providerCursor.toArray();
|
|
570
|
+
return await (await this.aggregate([{ $collStats: { latencyStats: options } }])).toArray();
|
|
550
571
|
}
|
|
551
572
|
async initializeOrderedBulkOp() {
|
|
552
573
|
this._emitCollectionApiCall('initializeOrderedBulkOp');
|
|
@@ -564,13 +585,13 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
564
585
|
}
|
|
565
586
|
async mapReduce(map, reduce, optionsOrOutString) {
|
|
566
587
|
await this._instanceState.printDeprecationWarning('Collection.mapReduce() is deprecated. Use an aggregation instead.\nSee https://docs.mongodb.com/manual/core/map-reduce for details.');
|
|
567
|
-
helpers_1.assertArgsDefinedType([map, reduce, optionsOrOutString], [true, true, true], 'Collection.mapReduce');
|
|
588
|
+
(0, helpers_1.assertArgsDefinedType)([map, reduce, optionsOrOutString], [true, true, true], 'Collection.mapReduce');
|
|
568
589
|
this._emitCollectionApiCall('mapReduce', { map, reduce, out: optionsOrOutString });
|
|
569
590
|
let cmd = {
|
|
570
591
|
mapReduce: this._name,
|
|
571
592
|
map: map,
|
|
572
593
|
reduce: reduce,
|
|
573
|
-
...helpers_1.processMapReduceOptions(optionsOrOutString)
|
|
594
|
+
...(0, helpers_1.processMapReduceOptions)(optionsOrOutString)
|
|
574
595
|
};
|
|
575
596
|
if (cmd.explain) {
|
|
576
597
|
const verbosity = cmd.explain;
|
|
@@ -634,10 +655,10 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
634
655
|
const estChunkData = (shardStats.numChunks === 0) ? 0 : (shardStats.size / shardStats.numChunks);
|
|
635
656
|
const estChunkCount = (shardStats.numChunks === 0) ? 0 : Math.floor(shardStats.count / shardStats.numChunks);
|
|
636
657
|
result[key] = {
|
|
637
|
-
data: helpers_1.dataFormat(shardStats.size),
|
|
658
|
+
data: (0, helpers_1.dataFormat)(shardStats.size),
|
|
638
659
|
docs: shardStats.count,
|
|
639
660
|
chunks: shardStats.numChunks,
|
|
640
|
-
'estimated data per chunk': helpers_1.dataFormat(estChunkData),
|
|
661
|
+
'estimated data per chunk': (0, helpers_1.dataFormat)(estChunkData),
|
|
641
662
|
'estimated docs per chunk': estChunkCount
|
|
642
663
|
};
|
|
643
664
|
totals.size += shardStats.size;
|
|
@@ -646,7 +667,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
646
667
|
conciseShardsStats.push(shardStats);
|
|
647
668
|
})())));
|
|
648
669
|
const totalValue = {
|
|
649
|
-
data: helpers_1.dataFormat(totals.size),
|
|
670
|
+
data: (0, helpers_1.dataFormat)(totals.size),
|
|
650
671
|
docs: totals.count,
|
|
651
672
|
chunks: totals.numChunks
|
|
652
673
|
};
|
|
@@ -656,7 +677,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
656
677
|
totalValue[`Shard ${shardStats.shardId}`] = [
|
|
657
678
|
`${estDataPercent} % data`,
|
|
658
679
|
`${estDocPercent} % docs in cluster`,
|
|
659
|
-
`${helpers_1.dataFormat(shardStats.avgObjSize)} avg obj size on shard`
|
|
680
|
+
`${(0, helpers_1.dataFormat)(shardStats.avgObjSize)} avg obj size on shard`
|
|
660
681
|
];
|
|
661
682
|
}
|
|
662
683
|
result.Totals = totalValue;
|
|
@@ -680,282 +701,280 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
680
701
|
}
|
|
681
702
|
async hideIndex(index) {
|
|
682
703
|
this._emitCollectionApiCall('hideIndex');
|
|
683
|
-
return helpers_1.setHideIndex(this, index, true);
|
|
704
|
+
return (0, helpers_1.setHideIndex)(this, index, true);
|
|
684
705
|
}
|
|
685
706
|
async unhideIndex(index) {
|
|
686
707
|
this._emitCollectionApiCall('unhideIndex');
|
|
687
|
-
return helpers_1.setHideIndex(this, index, false);
|
|
708
|
+
return (0, helpers_1.setHideIndex)(this, index, false);
|
|
688
709
|
}
|
|
689
710
|
};
|
|
690
711
|
__decorate([
|
|
691
712
|
decorators_1.returnsPromise,
|
|
692
|
-
decorators_1.returnType('AggregationCursor'),
|
|
693
|
-
decorators_1.apiVersions([1])
|
|
713
|
+
(0, decorators_1.returnType)('AggregationCursor'),
|
|
714
|
+
(0, decorators_1.apiVersions)([1])
|
|
694
715
|
], Collection.prototype, "aggregate", null);
|
|
695
716
|
__decorate([
|
|
696
717
|
decorators_1.returnsPromise,
|
|
697
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
698
|
-
decorators_1.apiVersions([1])
|
|
718
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
719
|
+
(0, decorators_1.apiVersions)([1])
|
|
699
720
|
], Collection.prototype, "bulkWrite", null);
|
|
700
721
|
__decorate([
|
|
701
722
|
decorators_1.returnsPromise,
|
|
702
723
|
decorators_1.deprecated,
|
|
703
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
704
|
-
decorators_1.apiVersions([])
|
|
724
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
725
|
+
(0, decorators_1.apiVersions)([])
|
|
705
726
|
], Collection.prototype, "count", null);
|
|
706
727
|
__decorate([
|
|
707
728
|
decorators_1.returnsPromise,
|
|
708
|
-
decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
|
|
709
|
-
decorators_1.apiVersions([1])
|
|
729
|
+
(0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
|
|
730
|
+
(0, decorators_1.apiVersions)([1])
|
|
710
731
|
], Collection.prototype, "countDocuments", null);
|
|
711
732
|
__decorate([
|
|
712
733
|
decorators_1.returnsPromise,
|
|
713
|
-
decorators_1.apiVersions([1])
|
|
734
|
+
(0, decorators_1.apiVersions)([1])
|
|
714
735
|
], Collection.prototype, "deleteMany", null);
|
|
715
736
|
__decorate([
|
|
716
737
|
decorators_1.returnsPromise,
|
|
717
|
-
decorators_1.apiVersions([1])
|
|
738
|
+
(0, decorators_1.apiVersions)([1])
|
|
718
739
|
], Collection.prototype, "deleteOne", null);
|
|
719
740
|
__decorate([
|
|
720
741
|
decorators_1.returnsPromise,
|
|
721
|
-
decorators_1.apiVersions([])
|
|
742
|
+
(0, decorators_1.apiVersions)([])
|
|
722
743
|
], Collection.prototype, "distinct", null);
|
|
723
744
|
__decorate([
|
|
724
745
|
decorators_1.returnsPromise,
|
|
725
|
-
decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
|
|
726
|
-
decorators_1.apiVersions([1])
|
|
746
|
+
(0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
|
|
747
|
+
(0, decorators_1.apiVersions)([1])
|
|
727
748
|
], Collection.prototype, "estimatedDocumentCount", null);
|
|
728
749
|
__decorate([
|
|
729
|
-
decorators_1.returnType('Cursor'),
|
|
730
|
-
decorators_1.apiVersions([1]),
|
|
750
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
751
|
+
(0, decorators_1.apiVersions)([1]),
|
|
731
752
|
decorators_1.returnsPromise
|
|
732
753
|
], Collection.prototype, "find", null);
|
|
733
754
|
__decorate([
|
|
734
755
|
decorators_1.returnsPromise,
|
|
735
756
|
decorators_1.deprecated,
|
|
736
|
-
decorators_1.apiVersions([1])
|
|
757
|
+
(0, decorators_1.apiVersions)([1])
|
|
737
758
|
], Collection.prototype, "findAndModify", null);
|
|
738
759
|
__decorate([
|
|
739
760
|
decorators_1.returnsPromise,
|
|
740
|
-
decorators_1.returnType('Document'),
|
|
741
|
-
decorators_1.apiVersions([1])
|
|
761
|
+
(0, decorators_1.returnType)('Document'),
|
|
762
|
+
(0, decorators_1.apiVersions)([1])
|
|
742
763
|
], Collection.prototype, "findOne", null);
|
|
743
764
|
__decorate([
|
|
744
765
|
decorators_1.returnsPromise,
|
|
745
|
-
decorators_1.apiVersions([])
|
|
766
|
+
(0, decorators_1.apiVersions)([])
|
|
746
767
|
], Collection.prototype, "renameCollection", null);
|
|
747
768
|
__decorate([
|
|
748
769
|
decorators_1.returnsPromise,
|
|
749
|
-
decorators_1.returnType('Document'),
|
|
750
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
751
|
-
decorators_1.apiVersions([1])
|
|
770
|
+
(0, decorators_1.returnType)('Document'),
|
|
771
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
772
|
+
(0, decorators_1.apiVersions)([1])
|
|
752
773
|
], Collection.prototype, "findOneAndDelete", null);
|
|
753
774
|
__decorate([
|
|
754
775
|
decorators_1.returnsPromise,
|
|
755
|
-
decorators_1.returnType('Document'),
|
|
756
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
757
|
-
decorators_1.apiVersions([1])
|
|
776
|
+
(0, decorators_1.returnType)('Document'),
|
|
777
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
778
|
+
(0, decorators_1.apiVersions)([1])
|
|
758
779
|
], Collection.prototype, "findOneAndReplace", null);
|
|
759
780
|
__decorate([
|
|
760
781
|
decorators_1.returnsPromise,
|
|
761
|
-
decorators_1.returnType('Document'),
|
|
762
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
763
|
-
decorators_1.apiVersions([1])
|
|
782
|
+
(0, decorators_1.returnType)('Document'),
|
|
783
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
784
|
+
(0, decorators_1.apiVersions)([1])
|
|
764
785
|
], Collection.prototype, "findOneAndUpdate", null);
|
|
765
786
|
__decorate([
|
|
766
787
|
decorators_1.returnsPromise,
|
|
767
788
|
decorators_1.deprecated,
|
|
768
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.6.0']),
|
|
769
|
-
decorators_1.apiVersions([1])
|
|
789
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.6.0']),
|
|
790
|
+
(0, decorators_1.apiVersions)([1])
|
|
770
791
|
], Collection.prototype, "insert", null);
|
|
771
792
|
__decorate([
|
|
772
793
|
decorators_1.returnsPromise,
|
|
773
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
774
|
-
decorators_1.apiVersions([1])
|
|
794
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
795
|
+
(0, decorators_1.apiVersions)([1])
|
|
775
796
|
], Collection.prototype, "insertMany", null);
|
|
776
797
|
__decorate([
|
|
777
798
|
decorators_1.returnsPromise,
|
|
778
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
779
|
-
decorators_1.apiVersions([1])
|
|
799
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
800
|
+
(0, decorators_1.apiVersions)([1])
|
|
780
801
|
], Collection.prototype, "insertOne", null);
|
|
781
802
|
__decorate([
|
|
782
803
|
decorators_1.returnsPromise,
|
|
783
|
-
decorators_1.apiVersions([1])
|
|
804
|
+
(0, decorators_1.apiVersions)([1])
|
|
784
805
|
], Collection.prototype, "isCapped", null);
|
|
785
806
|
__decorate([
|
|
786
807
|
decorators_1.returnsPromise,
|
|
787
808
|
decorators_1.deprecated,
|
|
788
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
789
|
-
decorators_1.apiVersions([1])
|
|
809
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
810
|
+
(0, decorators_1.apiVersions)([1])
|
|
790
811
|
], Collection.prototype, "remove", null);
|
|
791
|
-
__decorate([
|
|
792
|
-
decorators_1.deprecated
|
|
793
|
-
], Collection.prototype, "save", null);
|
|
794
812
|
__decorate([
|
|
795
813
|
decorators_1.returnsPromise,
|
|
796
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
797
|
-
decorators_1.apiVersions([1])
|
|
814
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
815
|
+
(0, decorators_1.apiVersions)([1])
|
|
798
816
|
], Collection.prototype, "replaceOne", null);
|
|
799
817
|
__decorate([
|
|
800
818
|
decorators_1.returnsPromise,
|
|
801
819
|
decorators_1.deprecated,
|
|
802
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
803
|
-
decorators_1.apiVersions([1])
|
|
820
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
821
|
+
(0, decorators_1.apiVersions)([1])
|
|
804
822
|
], Collection.prototype, "update", null);
|
|
805
823
|
__decorate([
|
|
806
824
|
decorators_1.returnsPromise,
|
|
807
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
808
|
-
decorators_1.apiVersions([1])
|
|
825
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
826
|
+
(0, decorators_1.apiVersions)([1])
|
|
809
827
|
], Collection.prototype, "updateMany", null);
|
|
810
828
|
__decorate([
|
|
811
829
|
decorators_1.returnsPromise,
|
|
812
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
813
|
-
decorators_1.apiVersions([1])
|
|
830
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
831
|
+
(0, decorators_1.apiVersions)([1])
|
|
814
832
|
], Collection.prototype, "updateOne", null);
|
|
815
833
|
__decorate([
|
|
816
834
|
decorators_1.returnsPromise,
|
|
817
|
-
decorators_1.apiVersions([])
|
|
835
|
+
(0, decorators_1.apiVersions)([])
|
|
818
836
|
], Collection.prototype, "convertToCapped", null);
|
|
819
837
|
__decorate([
|
|
820
838
|
decorators_1.returnsPromise,
|
|
821
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
822
|
-
decorators_1.apiVersions([1])
|
|
839
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
840
|
+
(0, decorators_1.apiVersions)([1])
|
|
823
841
|
], Collection.prototype, "createIndexes", null);
|
|
824
842
|
__decorate([
|
|
825
843
|
decorators_1.returnsPromise,
|
|
826
|
-
decorators_1.apiVersions([1])
|
|
844
|
+
(0, decorators_1.apiVersions)([1])
|
|
827
845
|
], Collection.prototype, "createIndex", null);
|
|
828
846
|
__decorate([
|
|
829
847
|
decorators_1.returnsPromise,
|
|
830
|
-
decorators_1.apiVersions([1])
|
|
848
|
+
(0, decorators_1.apiVersions)([1])
|
|
831
849
|
], Collection.prototype, "ensureIndex", null);
|
|
832
850
|
__decorate([
|
|
833
851
|
decorators_1.returnsPromise,
|
|
834
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
835
|
-
decorators_1.apiVersions([1])
|
|
852
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
853
|
+
(0, decorators_1.apiVersions)([1])
|
|
836
854
|
], Collection.prototype, "getIndexes", null);
|
|
837
855
|
__decorate([
|
|
838
856
|
decorators_1.returnsPromise,
|
|
839
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
840
|
-
decorators_1.apiVersions([1])
|
|
857
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
858
|
+
(0, decorators_1.apiVersions)([1])
|
|
841
859
|
], Collection.prototype, "getIndexSpecs", null);
|
|
842
860
|
__decorate([
|
|
843
861
|
decorators_1.returnsPromise,
|
|
844
|
-
decorators_1.apiVersions([1])
|
|
862
|
+
(0, decorators_1.apiVersions)([1])
|
|
845
863
|
], Collection.prototype, "getIndices", null);
|
|
846
864
|
__decorate([
|
|
847
865
|
decorators_1.returnsPromise,
|
|
848
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
849
|
-
decorators_1.apiVersions([1])
|
|
866
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
867
|
+
(0, decorators_1.apiVersions)([1])
|
|
850
868
|
], Collection.prototype, "getIndexKeys", null);
|
|
851
869
|
__decorate([
|
|
852
870
|
decorators_1.returnsPromise,
|
|
853
|
-
decorators_1.apiVersions([1])
|
|
871
|
+
(0, decorators_1.apiVersions)([1])
|
|
854
872
|
], Collection.prototype, "dropIndexes", null);
|
|
855
873
|
__decorate([
|
|
856
874
|
decorators_1.returnsPromise,
|
|
857
|
-
decorators_1.apiVersions([1])
|
|
875
|
+
(0, decorators_1.apiVersions)([1])
|
|
858
876
|
], Collection.prototype, "dropIndex", null);
|
|
859
877
|
__decorate([
|
|
860
878
|
decorators_1.returnsPromise,
|
|
861
|
-
decorators_1.apiVersions([])
|
|
879
|
+
(0, decorators_1.apiVersions)([])
|
|
862
880
|
], Collection.prototype, "totalIndexSize", null);
|
|
863
881
|
__decorate([
|
|
864
882
|
decorators_1.returnsPromise,
|
|
865
|
-
decorators_1.
|
|
866
|
-
decorators_1.
|
|
883
|
+
decorators_1.deprecated,
|
|
884
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Standalone]),
|
|
885
|
+
(0, decorators_1.apiVersions)([])
|
|
867
886
|
], Collection.prototype, "reIndex", null);
|
|
868
887
|
__decorate([
|
|
869
|
-
decorators_1.returnType('Database')
|
|
888
|
+
(0, decorators_1.returnType)('Database')
|
|
870
889
|
], Collection.prototype, "getDB", null);
|
|
871
890
|
__decorate([
|
|
872
|
-
decorators_1.returnType('Mongo')
|
|
891
|
+
(0, decorators_1.returnType)('Mongo')
|
|
873
892
|
], Collection.prototype, "getMongo", null);
|
|
874
893
|
__decorate([
|
|
875
894
|
decorators_1.returnsPromise,
|
|
876
|
-
decorators_1.apiVersions([])
|
|
895
|
+
(0, decorators_1.apiVersions)([])
|
|
877
896
|
], Collection.prototype, "dataSize", null);
|
|
878
897
|
__decorate([
|
|
879
898
|
decorators_1.returnsPromise,
|
|
880
|
-
decorators_1.apiVersions([])
|
|
899
|
+
(0, decorators_1.apiVersions)([])
|
|
881
900
|
], Collection.prototype, "storageSize", null);
|
|
882
901
|
__decorate([
|
|
883
902
|
decorators_1.returnsPromise,
|
|
884
|
-
decorators_1.apiVersions([])
|
|
903
|
+
(0, decorators_1.apiVersions)([])
|
|
885
904
|
], Collection.prototype, "totalSize", null);
|
|
886
905
|
__decorate([
|
|
887
906
|
decorators_1.returnsPromise,
|
|
888
|
-
decorators_1.apiVersions([1])
|
|
907
|
+
(0, decorators_1.apiVersions)([1])
|
|
889
908
|
], Collection.prototype, "drop", null);
|
|
890
909
|
__decorate([
|
|
891
910
|
decorators_1.returnsPromise,
|
|
892
|
-
decorators_1.apiVersions([1])
|
|
911
|
+
(0, decorators_1.apiVersions)([1])
|
|
893
912
|
], Collection.prototype, "exists", null);
|
|
894
913
|
__decorate([
|
|
895
914
|
decorators_1.returnsPromise,
|
|
896
|
-
decorators_1.apiVersions([1])
|
|
915
|
+
(0, decorators_1.apiVersions)([1])
|
|
897
916
|
], Collection.prototype, "runCommand", null);
|
|
898
917
|
__decorate([
|
|
899
|
-
decorators_1.returnType('Explainable'),
|
|
900
|
-
decorators_1.apiVersions([1])
|
|
918
|
+
(0, decorators_1.returnType)('Explainable'),
|
|
919
|
+
(0, decorators_1.apiVersions)([1])
|
|
901
920
|
], Collection.prototype, "explain", null);
|
|
902
921
|
__decorate([
|
|
903
922
|
decorators_1.returnsPromise,
|
|
904
|
-
decorators_1.apiVersions([])
|
|
923
|
+
(0, decorators_1.apiVersions)([])
|
|
905
924
|
], Collection.prototype, "stats", null);
|
|
906
925
|
__decorate([
|
|
907
926
|
decorators_1.returnsPromise,
|
|
908
|
-
decorators_1.apiVersions([])
|
|
927
|
+
(0, decorators_1.apiVersions)([])
|
|
909
928
|
], Collection.prototype, "latencyStats", null);
|
|
910
929
|
__decorate([
|
|
911
930
|
decorators_1.returnsPromise,
|
|
912
|
-
decorators_1.returnType('Bulk'),
|
|
913
|
-
decorators_1.apiVersions([1])
|
|
931
|
+
(0, decorators_1.returnType)('Bulk'),
|
|
932
|
+
(0, decorators_1.apiVersions)([1])
|
|
914
933
|
], Collection.prototype, "initializeOrderedBulkOp", null);
|
|
915
934
|
__decorate([
|
|
916
935
|
decorators_1.returnsPromise,
|
|
917
|
-
decorators_1.returnType('Bulk'),
|
|
918
|
-
decorators_1.apiVersions([1])
|
|
936
|
+
(0, decorators_1.returnType)('Bulk'),
|
|
937
|
+
(0, decorators_1.apiVersions)([1])
|
|
919
938
|
], Collection.prototype, "initializeUnorderedBulkOp", null);
|
|
920
939
|
__decorate([
|
|
921
|
-
decorators_1.returnType('PlanCache'),
|
|
922
|
-
decorators_1.apiVersions([])
|
|
940
|
+
(0, decorators_1.returnType)('PlanCache'),
|
|
941
|
+
(0, decorators_1.apiVersions)([])
|
|
923
942
|
], Collection.prototype, "getPlanCache", null);
|
|
924
943
|
__decorate([
|
|
925
944
|
decorators_1.returnsPromise,
|
|
926
945
|
decorators_1.deprecated,
|
|
927
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.9.0']),
|
|
928
|
-
decorators_1.apiVersions([])
|
|
946
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.9.0']),
|
|
947
|
+
(0, decorators_1.apiVersions)([])
|
|
929
948
|
], Collection.prototype, "mapReduce", null);
|
|
930
949
|
__decorate([
|
|
931
950
|
decorators_1.returnsPromise,
|
|
932
|
-
decorators_1.apiVersions([])
|
|
951
|
+
(0, decorators_1.apiVersions)([])
|
|
933
952
|
], Collection.prototype, "validate", null);
|
|
934
953
|
__decorate([
|
|
935
954
|
decorators_1.returnsPromise,
|
|
936
|
-
decorators_1.topologies([enums_1.Topologies.Sharded]),
|
|
937
|
-
decorators_1.apiVersions([])
|
|
955
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
|
|
956
|
+
(0, decorators_1.apiVersions)([])
|
|
938
957
|
], Collection.prototype, "getShardVersion", null);
|
|
939
958
|
__decorate([
|
|
940
959
|
decorators_1.returnsPromise,
|
|
941
|
-
decorators_1.topologies([enums_1.Topologies.Sharded]),
|
|
942
|
-
decorators_1.apiVersions([])
|
|
960
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
|
|
961
|
+
(0, decorators_1.apiVersions)([])
|
|
943
962
|
], Collection.prototype, "getShardDistribution", null);
|
|
944
963
|
__decorate([
|
|
945
|
-
decorators_1.serverVersions(['3.1.0', enums_1.ServerVersions.latest]),
|
|
946
|
-
decorators_1.topologies([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
|
|
947
|
-
decorators_1.apiVersions([1]),
|
|
964
|
+
(0, decorators_1.serverVersions)(['3.1.0', enums_1.ServerVersions.latest]),
|
|
965
|
+
(0, decorators_1.topologies)([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
|
|
966
|
+
(0, decorators_1.apiVersions)([1]),
|
|
948
967
|
decorators_1.returnsPromise
|
|
949
968
|
], Collection.prototype, "watch", null);
|
|
950
969
|
__decorate([
|
|
951
|
-
decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
|
|
970
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
952
971
|
decorators_1.returnsPromise,
|
|
953
|
-
decorators_1.apiVersions([1])
|
|
972
|
+
(0, decorators_1.apiVersions)([1])
|
|
954
973
|
], Collection.prototype, "hideIndex", null);
|
|
955
974
|
__decorate([
|
|
956
|
-
decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
|
|
975
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
957
976
|
decorators_1.returnsPromise,
|
|
958
|
-
decorators_1.apiVersions([1])
|
|
977
|
+
(0, decorators_1.apiVersions)([1])
|
|
959
978
|
], Collection.prototype, "unhideIndex", null);
|
|
960
979
|
Collection = __decorate([
|
|
961
980
|
decorators_1.shellApiClassDefault,
|