@mongosh/shell-api 1.3.0 → 1.4.2
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 +4 -3
- package/lib/collection.js +194 -164
- package/lib/collection.js.map +1 -1
- package/lib/cursor.d.ts +1 -1
- package/lib/cursor.js +30 -30
- package/lib/cursor.js.map +1 -1
- package/lib/database.d.ts +1 -1
- package/lib/database.js +128 -135
- 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 +7 -4
- package/lib/field-level-encryption.js +49 -26
- package/lib/field-level-encryption.js.map +1 -1
- package/lib/helpers.d.ts +1 -0
- package/lib/helpers.js +39 -3
- package/lib/helpers.js.map +1 -1
- package/lib/mongo.d.ts +7 -6
- package/lib/mongo.js +66 -53
- 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,28 +271,35 @@ 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
|
}
|
|
296
|
+
async compactStructuredEncryptionData() {
|
|
297
|
+
if (!this._mongo._fleOptions) {
|
|
298
|
+
throw new errors_1.MongoshInvalidInputError('The "compactStructuredEncryptionData" command requires Mongo instance configured with auto encryption.', errors_1.CommonErrors.InvalidArgument);
|
|
299
|
+
}
|
|
300
|
+
this._emitCollectionApiCall('compactStructuredEncryptionData');
|
|
301
|
+
return await this._database._runCommand({ compactStructuredEncryptionData: this._name });
|
|
302
|
+
}
|
|
294
303
|
async convertToCapped(size) {
|
|
295
304
|
this._emitCollectionApiCall('convertToCapped', { size });
|
|
296
305
|
return await this._database._runCommand({
|
|
@@ -299,7 +308,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
299
308
|
});
|
|
300
309
|
}
|
|
301
310
|
async _createIndexes(keyPatterns, options = {}, commitQuorum) {
|
|
302
|
-
helpers_1.assertArgsDefinedType([keyPatterns], [true], 'Collection.createIndexes');
|
|
311
|
+
(0, helpers_1.assertArgsDefinedType)([keyPatterns], [true], 'Collection.createIndexes');
|
|
303
312
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
304
313
|
throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
|
|
305
314
|
}
|
|
@@ -320,7 +329,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
320
329
|
return this._createIndexes(keyPatterns, options, commitQuorum);
|
|
321
330
|
}
|
|
322
331
|
async createIndex(keys, options = {}, commitQuorum) {
|
|
323
|
-
helpers_1.assertArgsDefinedType([keys], [true], 'Collection.createIndex');
|
|
332
|
+
(0, helpers_1.assertArgsDefinedType)([keys], [true], 'Collection.createIndex');
|
|
324
333
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
325
334
|
throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
|
|
326
335
|
}
|
|
@@ -361,8 +370,8 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
361
370
|
});
|
|
362
371
|
}
|
|
363
372
|
catch (error) {
|
|
364
|
-
if ((error.codeName === 'IndexNotFound' || error.codeName === undefined) &&
|
|
365
|
-
(error.errmsg === 'invalid index name spec' || error.errmsg === undefined) &&
|
|
373
|
+
if (((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound' || (error === null || error === void 0 ? void 0 : error.codeName) === undefined) &&
|
|
374
|
+
((error === null || error === void 0 ? void 0 : error.errmsg) === 'invalid index name spec' || (error === null || error === void 0 ? void 0 : error.errmsg) === undefined) &&
|
|
366
375
|
Array.isArray(indexes) &&
|
|
367
376
|
indexes.length > 0 &&
|
|
368
377
|
(await this._database.version()).match(/^4\.0\./)) {
|
|
@@ -372,7 +381,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
372
381
|
return errored;
|
|
373
382
|
return all.sort((a, b) => b.nIndexesWas - a.nIndexesWas)[0];
|
|
374
383
|
}
|
|
375
|
-
if (error.codeName === 'IndexNotFound') {
|
|
384
|
+
if ((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound') {
|
|
376
385
|
return {
|
|
377
386
|
ok: error.ok,
|
|
378
387
|
errmsg: error.errmsg,
|
|
@@ -384,7 +393,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
384
393
|
}
|
|
385
394
|
}
|
|
386
395
|
async dropIndex(index) {
|
|
387
|
-
helpers_1.assertArgsDefinedType([index], [true], 'Collection.dropIndex');
|
|
396
|
+
(0, helpers_1.assertArgsDefinedType)([index], [true], 'Collection.dropIndex');
|
|
388
397
|
this._emitCollectionApiCall('dropIndex', { index });
|
|
389
398
|
if (index === '*') {
|
|
390
399
|
throw new errors_1.MongoshInvalidInputError('To drop indexes in the collection using \'*\', use db.collection.dropIndexes().', errors_1.CommonErrors.InvalidArgument);
|
|
@@ -394,13 +403,20 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
394
403
|
}
|
|
395
404
|
return this.dropIndexes(index);
|
|
396
405
|
}
|
|
406
|
+
async _getSingleStorageStatValue(key) {
|
|
407
|
+
const cursor = await this.aggregate([
|
|
408
|
+
{ $collStats: { storageStats: {} } },
|
|
409
|
+
{ $group: { _id: null, value: { $sum: `$storageStats.${key}` } } }
|
|
410
|
+
]);
|
|
411
|
+
const [{ value }] = await cursor.toArray();
|
|
412
|
+
return value;
|
|
413
|
+
}
|
|
397
414
|
async totalIndexSize(...args) {
|
|
398
415
|
this._emitCollectionApiCall('totalIndexSize');
|
|
399
416
|
if (args.length) {
|
|
400
417
|
throw new errors_1.MongoshInvalidInputError('"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.', errors_1.CommonErrors.InvalidArgument);
|
|
401
418
|
}
|
|
402
|
-
|
|
403
|
-
return stats.totalIndexSize;
|
|
419
|
+
return this._getSingleStorageStatValue('totalIndexSize');
|
|
404
420
|
}
|
|
405
421
|
async reIndex() {
|
|
406
422
|
this._emitCollectionApiCall('reIndex');
|
|
@@ -418,26 +434,40 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
418
434
|
}
|
|
419
435
|
async dataSize() {
|
|
420
436
|
this._emitCollectionApiCall('dataSize');
|
|
421
|
-
|
|
422
|
-
return stats.size;
|
|
437
|
+
return this._getSingleStorageStatValue('size');
|
|
423
438
|
}
|
|
424
439
|
async storageSize() {
|
|
425
440
|
this._emitCollectionApiCall('storageSize');
|
|
426
|
-
|
|
427
|
-
return stats.storageSize;
|
|
441
|
+
return this._getSingleStorageStatValue('storageSize');
|
|
428
442
|
}
|
|
429
443
|
async totalSize() {
|
|
430
444
|
this._emitCollectionApiCall('totalSize');
|
|
431
|
-
|
|
432
|
-
return (Number(stats.storageSize) || 0) + (Number(stats.totalIndexSize) || 0);
|
|
445
|
+
return this._getSingleStorageStatValue('totalSize');
|
|
433
446
|
}
|
|
434
|
-
async drop() {
|
|
447
|
+
async drop(options = {}) {
|
|
448
|
+
var _a, _b, _c;
|
|
435
449
|
this._emitCollectionApiCall('drop');
|
|
450
|
+
let encryptedFieldsOptions = {};
|
|
451
|
+
const encryptedFieldsMap = (_a = this._mongo._fleOptions) === null || _a === void 0 ? void 0 : _a.encryptedFieldsMap;
|
|
452
|
+
const encryptedFields = encryptedFieldsMap === null || encryptedFieldsMap === void 0 ? void 0 : encryptedFieldsMap[`${this._database._name}.${this._name}`];
|
|
453
|
+
if (!encryptedFields && !options.encryptedFields) {
|
|
454
|
+
try {
|
|
455
|
+
const collectionInfos = await this._mongo._serviceProvider.listCollections(this._database._name, {
|
|
456
|
+
name: this._name
|
|
457
|
+
}, await this._database._baseOptions());
|
|
458
|
+
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;
|
|
459
|
+
if (encryptedFields) {
|
|
460
|
+
encryptedFieldsOptions = { encryptedFields };
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
catch (error) {
|
|
464
|
+
}
|
|
465
|
+
}
|
|
436
466
|
try {
|
|
437
|
-
return await this._mongo._serviceProvider.dropCollection(this._database._name, this._name, await this._database._baseOptions());
|
|
467
|
+
return await this._mongo._serviceProvider.dropCollection(this._database._name, this._name, { ...await this._database._baseOptions(), ...options, ...encryptedFieldsOptions });
|
|
438
468
|
}
|
|
439
469
|
catch (error) {
|
|
440
|
-
if (error.codeName === 'NamespaceNotFound') {
|
|
470
|
+
if ((error === null || error === void 0 ? void 0 : error.codeName) === 'NamespaceNotFound') {
|
|
441
471
|
this._mongo._instanceState.messageBus.emit('mongosh:warn', {
|
|
442
472
|
method: 'drop',
|
|
443
473
|
class: 'Collection',
|
|
@@ -464,7 +494,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
464
494
|
return `${this._name}`;
|
|
465
495
|
}
|
|
466
496
|
async runCommand(commandName, options) {
|
|
467
|
-
helpers_1.assertArgsDefinedType([commandName], [['string', 'object']], 'Collection.runCommand');
|
|
497
|
+
(0, helpers_1.assertArgsDefinedType)([commandName], [['string', 'object']], 'Collection.runCommand');
|
|
468
498
|
if (options) {
|
|
469
499
|
if (typeof commandName !== 'string') {
|
|
470
500
|
throw new errors_1.MongoshInvalidInputError('Collection.runCommand takes a command string as its first arugment', errors_1.CommonErrors.InvalidArgument);
|
|
@@ -484,7 +514,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
484
514
|
return await this._database._runCommand(cmd);
|
|
485
515
|
}
|
|
486
516
|
explain(verbosity = 'queryPlanner') {
|
|
487
|
-
verbosity = helpers_1.validateExplainableVerbosity(verbosity);
|
|
517
|
+
verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
|
|
488
518
|
this._emitCollectionApiCall('explain', { verbosity });
|
|
489
519
|
return new index_1.Explainable(this._mongo, this, verbosity);
|
|
490
520
|
}
|
|
@@ -544,9 +574,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
544
574
|
}
|
|
545
575
|
async latencyStats(options = {}) {
|
|
546
576
|
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();
|
|
577
|
+
return await (await this.aggregate([{ $collStats: { latencyStats: options } }])).toArray();
|
|
550
578
|
}
|
|
551
579
|
async initializeOrderedBulkOp() {
|
|
552
580
|
this._emitCollectionApiCall('initializeOrderedBulkOp');
|
|
@@ -564,13 +592,13 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
564
592
|
}
|
|
565
593
|
async mapReduce(map, reduce, optionsOrOutString) {
|
|
566
594
|
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');
|
|
595
|
+
(0, helpers_1.assertArgsDefinedType)([map, reduce, optionsOrOutString], [true, true, true], 'Collection.mapReduce');
|
|
568
596
|
this._emitCollectionApiCall('mapReduce', { map, reduce, out: optionsOrOutString });
|
|
569
597
|
let cmd = {
|
|
570
598
|
mapReduce: this._name,
|
|
571
599
|
map: map,
|
|
572
600
|
reduce: reduce,
|
|
573
|
-
...helpers_1.processMapReduceOptions(optionsOrOutString)
|
|
601
|
+
...(0, helpers_1.processMapReduceOptions)(optionsOrOutString)
|
|
574
602
|
};
|
|
575
603
|
if (cmd.explain) {
|
|
576
604
|
const verbosity = cmd.explain;
|
|
@@ -634,10 +662,10 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
634
662
|
const estChunkData = (shardStats.numChunks === 0) ? 0 : (shardStats.size / shardStats.numChunks);
|
|
635
663
|
const estChunkCount = (shardStats.numChunks === 0) ? 0 : Math.floor(shardStats.count / shardStats.numChunks);
|
|
636
664
|
result[key] = {
|
|
637
|
-
data: helpers_1.dataFormat(shardStats.size),
|
|
665
|
+
data: (0, helpers_1.dataFormat)(shardStats.size),
|
|
638
666
|
docs: shardStats.count,
|
|
639
667
|
chunks: shardStats.numChunks,
|
|
640
|
-
'estimated data per chunk': helpers_1.dataFormat(estChunkData),
|
|
668
|
+
'estimated data per chunk': (0, helpers_1.dataFormat)(estChunkData),
|
|
641
669
|
'estimated docs per chunk': estChunkCount
|
|
642
670
|
};
|
|
643
671
|
totals.size += shardStats.size;
|
|
@@ -646,7 +674,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
646
674
|
conciseShardsStats.push(shardStats);
|
|
647
675
|
})())));
|
|
648
676
|
const totalValue = {
|
|
649
|
-
data: helpers_1.dataFormat(totals.size),
|
|
677
|
+
data: (0, helpers_1.dataFormat)(totals.size),
|
|
650
678
|
docs: totals.count,
|
|
651
679
|
chunks: totals.numChunks
|
|
652
680
|
};
|
|
@@ -656,7 +684,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
656
684
|
totalValue[`Shard ${shardStats.shardId}`] = [
|
|
657
685
|
`${estDataPercent} % data`,
|
|
658
686
|
`${estDocPercent} % docs in cluster`,
|
|
659
|
-
`${helpers_1.dataFormat(shardStats.avgObjSize)} avg obj size on shard`
|
|
687
|
+
`${(0, helpers_1.dataFormat)(shardStats.avgObjSize)} avg obj size on shard`
|
|
660
688
|
];
|
|
661
689
|
}
|
|
662
690
|
result.Totals = totalValue;
|
|
@@ -680,282 +708,284 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
|
|
|
680
708
|
}
|
|
681
709
|
async hideIndex(index) {
|
|
682
710
|
this._emitCollectionApiCall('hideIndex');
|
|
683
|
-
return helpers_1.setHideIndex(this, index, true);
|
|
711
|
+
return (0, helpers_1.setHideIndex)(this, index, true);
|
|
684
712
|
}
|
|
685
713
|
async unhideIndex(index) {
|
|
686
714
|
this._emitCollectionApiCall('unhideIndex');
|
|
687
|
-
return helpers_1.setHideIndex(this, index, false);
|
|
715
|
+
return (0, helpers_1.setHideIndex)(this, index, false);
|
|
688
716
|
}
|
|
689
717
|
};
|
|
690
718
|
__decorate([
|
|
691
719
|
decorators_1.returnsPromise,
|
|
692
|
-
decorators_1.returnType('AggregationCursor'),
|
|
693
|
-
decorators_1.apiVersions([1])
|
|
720
|
+
(0, decorators_1.returnType)('AggregationCursor'),
|
|
721
|
+
(0, decorators_1.apiVersions)([1])
|
|
694
722
|
], Collection.prototype, "aggregate", null);
|
|
695
723
|
__decorate([
|
|
696
724
|
decorators_1.returnsPromise,
|
|
697
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
698
|
-
decorators_1.apiVersions([1])
|
|
725
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
726
|
+
(0, decorators_1.apiVersions)([1])
|
|
699
727
|
], Collection.prototype, "bulkWrite", null);
|
|
700
728
|
__decorate([
|
|
701
729
|
decorators_1.returnsPromise,
|
|
702
730
|
decorators_1.deprecated,
|
|
703
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
704
|
-
decorators_1.apiVersions([])
|
|
731
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
732
|
+
(0, decorators_1.apiVersions)([])
|
|
705
733
|
], Collection.prototype, "count", null);
|
|
706
734
|
__decorate([
|
|
707
735
|
decorators_1.returnsPromise,
|
|
708
|
-
decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
|
|
709
|
-
decorators_1.apiVersions([1])
|
|
736
|
+
(0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
|
|
737
|
+
(0, decorators_1.apiVersions)([1])
|
|
710
738
|
], Collection.prototype, "countDocuments", null);
|
|
711
739
|
__decorate([
|
|
712
740
|
decorators_1.returnsPromise,
|
|
713
|
-
decorators_1.apiVersions([1])
|
|
741
|
+
(0, decorators_1.apiVersions)([1])
|
|
714
742
|
], Collection.prototype, "deleteMany", null);
|
|
715
743
|
__decorate([
|
|
716
744
|
decorators_1.returnsPromise,
|
|
717
|
-
decorators_1.apiVersions([1])
|
|
745
|
+
(0, decorators_1.apiVersions)([1])
|
|
718
746
|
], Collection.prototype, "deleteOne", null);
|
|
719
747
|
__decorate([
|
|
720
748
|
decorators_1.returnsPromise,
|
|
721
|
-
decorators_1.apiVersions([])
|
|
749
|
+
(0, decorators_1.apiVersions)([])
|
|
722
750
|
], Collection.prototype, "distinct", null);
|
|
723
751
|
__decorate([
|
|
724
752
|
decorators_1.returnsPromise,
|
|
725
|
-
decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
|
|
726
|
-
decorators_1.apiVersions([1])
|
|
753
|
+
(0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
|
|
754
|
+
(0, decorators_1.apiVersions)([1])
|
|
727
755
|
], Collection.prototype, "estimatedDocumentCount", null);
|
|
728
756
|
__decorate([
|
|
729
|
-
decorators_1.returnType('Cursor'),
|
|
730
|
-
decorators_1.apiVersions([1]),
|
|
757
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
758
|
+
(0, decorators_1.apiVersions)([1]),
|
|
731
759
|
decorators_1.returnsPromise
|
|
732
760
|
], Collection.prototype, "find", null);
|
|
733
761
|
__decorate([
|
|
734
762
|
decorators_1.returnsPromise,
|
|
735
763
|
decorators_1.deprecated,
|
|
736
|
-
decorators_1.apiVersions([1])
|
|
764
|
+
(0, decorators_1.apiVersions)([1])
|
|
737
765
|
], Collection.prototype, "findAndModify", null);
|
|
738
766
|
__decorate([
|
|
739
767
|
decorators_1.returnsPromise,
|
|
740
|
-
decorators_1.returnType('Document'),
|
|
741
|
-
decorators_1.apiVersions([1])
|
|
768
|
+
(0, decorators_1.returnType)('Document'),
|
|
769
|
+
(0, decorators_1.apiVersions)([1])
|
|
742
770
|
], Collection.prototype, "findOne", null);
|
|
743
771
|
__decorate([
|
|
744
772
|
decorators_1.returnsPromise,
|
|
745
|
-
decorators_1.apiVersions([])
|
|
773
|
+
(0, decorators_1.apiVersions)([])
|
|
746
774
|
], Collection.prototype, "renameCollection", null);
|
|
747
775
|
__decorate([
|
|
748
776
|
decorators_1.returnsPromise,
|
|
749
|
-
decorators_1.returnType('Document'),
|
|
750
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
751
|
-
decorators_1.apiVersions([1])
|
|
777
|
+
(0, decorators_1.returnType)('Document'),
|
|
778
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
779
|
+
(0, decorators_1.apiVersions)([1])
|
|
752
780
|
], Collection.prototype, "findOneAndDelete", null);
|
|
753
781
|
__decorate([
|
|
754
782
|
decorators_1.returnsPromise,
|
|
755
|
-
decorators_1.returnType('Document'),
|
|
756
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
757
|
-
decorators_1.apiVersions([1])
|
|
783
|
+
(0, decorators_1.returnType)('Document'),
|
|
784
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
785
|
+
(0, decorators_1.apiVersions)([1])
|
|
758
786
|
], Collection.prototype, "findOneAndReplace", null);
|
|
759
787
|
__decorate([
|
|
760
788
|
decorators_1.returnsPromise,
|
|
761
|
-
decorators_1.returnType('Document'),
|
|
762
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
763
|
-
decorators_1.apiVersions([1])
|
|
789
|
+
(0, decorators_1.returnType)('Document'),
|
|
790
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
791
|
+
(0, decorators_1.apiVersions)([1])
|
|
764
792
|
], Collection.prototype, "findOneAndUpdate", null);
|
|
765
793
|
__decorate([
|
|
766
794
|
decorators_1.returnsPromise,
|
|
767
795
|
decorators_1.deprecated,
|
|
768
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.6.0']),
|
|
769
|
-
decorators_1.apiVersions([1])
|
|
796
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.6.0']),
|
|
797
|
+
(0, decorators_1.apiVersions)([1])
|
|
770
798
|
], Collection.prototype, "insert", null);
|
|
771
799
|
__decorate([
|
|
772
800
|
decorators_1.returnsPromise,
|
|
773
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
774
|
-
decorators_1.apiVersions([1])
|
|
801
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
802
|
+
(0, decorators_1.apiVersions)([1])
|
|
775
803
|
], Collection.prototype, "insertMany", null);
|
|
776
804
|
__decorate([
|
|
777
805
|
decorators_1.returnsPromise,
|
|
778
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
779
|
-
decorators_1.apiVersions([1])
|
|
806
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
807
|
+
(0, decorators_1.apiVersions)([1])
|
|
780
808
|
], Collection.prototype, "insertOne", null);
|
|
781
809
|
__decorate([
|
|
782
810
|
decorators_1.returnsPromise,
|
|
783
|
-
decorators_1.apiVersions([1])
|
|
811
|
+
(0, decorators_1.apiVersions)([1])
|
|
784
812
|
], Collection.prototype, "isCapped", null);
|
|
785
813
|
__decorate([
|
|
786
814
|
decorators_1.returnsPromise,
|
|
787
815
|
decorators_1.deprecated,
|
|
788
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
789
|
-
decorators_1.apiVersions([1])
|
|
816
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
817
|
+
(0, decorators_1.apiVersions)([1])
|
|
790
818
|
], Collection.prototype, "remove", null);
|
|
791
|
-
__decorate([
|
|
792
|
-
decorators_1.deprecated
|
|
793
|
-
], Collection.prototype, "save", null);
|
|
794
819
|
__decorate([
|
|
795
820
|
decorators_1.returnsPromise,
|
|
796
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
797
|
-
decorators_1.apiVersions([1])
|
|
821
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
822
|
+
(0, decorators_1.apiVersions)([1])
|
|
798
823
|
], Collection.prototype, "replaceOne", null);
|
|
799
824
|
__decorate([
|
|
800
825
|
decorators_1.returnsPromise,
|
|
801
826
|
decorators_1.deprecated,
|
|
802
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
803
|
-
decorators_1.apiVersions([1])
|
|
827
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
|
|
828
|
+
(0, decorators_1.apiVersions)([1])
|
|
804
829
|
], Collection.prototype, "update", null);
|
|
805
830
|
__decorate([
|
|
806
831
|
decorators_1.returnsPromise,
|
|
807
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
808
|
-
decorators_1.apiVersions([1])
|
|
832
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
833
|
+
(0, decorators_1.apiVersions)([1])
|
|
809
834
|
], Collection.prototype, "updateMany", null);
|
|
810
835
|
__decorate([
|
|
811
836
|
decorators_1.returnsPromise,
|
|
812
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
813
|
-
decorators_1.apiVersions([1])
|
|
837
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
838
|
+
(0, decorators_1.apiVersions)([1])
|
|
814
839
|
], Collection.prototype, "updateOne", null);
|
|
815
840
|
__decorate([
|
|
816
841
|
decorators_1.returnsPromise,
|
|
817
|
-
decorators_1.apiVersions([])
|
|
842
|
+
(0, decorators_1.apiVersions)([])
|
|
843
|
+
], Collection.prototype, "compactStructuredEncryptionData", null);
|
|
844
|
+
__decorate([
|
|
845
|
+
decorators_1.returnsPromise,
|
|
846
|
+
(0, decorators_1.apiVersions)([])
|
|
818
847
|
], Collection.prototype, "convertToCapped", null);
|
|
819
848
|
__decorate([
|
|
820
849
|
decorators_1.returnsPromise,
|
|
821
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
822
|
-
decorators_1.apiVersions([1])
|
|
850
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
851
|
+
(0, decorators_1.apiVersions)([1])
|
|
823
852
|
], Collection.prototype, "createIndexes", null);
|
|
824
853
|
__decorate([
|
|
825
854
|
decorators_1.returnsPromise,
|
|
826
|
-
decorators_1.apiVersions([1])
|
|
855
|
+
(0, decorators_1.apiVersions)([1])
|
|
827
856
|
], Collection.prototype, "createIndex", null);
|
|
828
857
|
__decorate([
|
|
829
858
|
decorators_1.returnsPromise,
|
|
830
|
-
decorators_1.apiVersions([1])
|
|
859
|
+
(0, decorators_1.apiVersions)([1])
|
|
831
860
|
], Collection.prototype, "ensureIndex", null);
|
|
832
861
|
__decorate([
|
|
833
862
|
decorators_1.returnsPromise,
|
|
834
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
835
|
-
decorators_1.apiVersions([1])
|
|
863
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
864
|
+
(0, decorators_1.apiVersions)([1])
|
|
836
865
|
], Collection.prototype, "getIndexes", null);
|
|
837
866
|
__decorate([
|
|
838
867
|
decorators_1.returnsPromise,
|
|
839
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
840
|
-
decorators_1.apiVersions([1])
|
|
868
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
869
|
+
(0, decorators_1.apiVersions)([1])
|
|
841
870
|
], Collection.prototype, "getIndexSpecs", null);
|
|
842
871
|
__decorate([
|
|
843
872
|
decorators_1.returnsPromise,
|
|
844
|
-
decorators_1.apiVersions([1])
|
|
873
|
+
(0, decorators_1.apiVersions)([1])
|
|
845
874
|
], Collection.prototype, "getIndices", null);
|
|
846
875
|
__decorate([
|
|
847
876
|
decorators_1.returnsPromise,
|
|
848
|
-
decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
|
|
849
|
-
decorators_1.apiVersions([1])
|
|
877
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
878
|
+
(0, decorators_1.apiVersions)([1])
|
|
850
879
|
], Collection.prototype, "getIndexKeys", null);
|
|
851
880
|
__decorate([
|
|
852
881
|
decorators_1.returnsPromise,
|
|
853
|
-
decorators_1.apiVersions([1])
|
|
882
|
+
(0, decorators_1.apiVersions)([1])
|
|
854
883
|
], Collection.prototype, "dropIndexes", null);
|
|
855
884
|
__decorate([
|
|
856
885
|
decorators_1.returnsPromise,
|
|
857
|
-
decorators_1.apiVersions([1])
|
|
886
|
+
(0, decorators_1.apiVersions)([1])
|
|
858
887
|
], Collection.prototype, "dropIndex", null);
|
|
859
888
|
__decorate([
|
|
860
889
|
decorators_1.returnsPromise,
|
|
861
|
-
decorators_1.apiVersions([])
|
|
890
|
+
(0, decorators_1.apiVersions)([])
|
|
862
891
|
], Collection.prototype, "totalIndexSize", null);
|
|
863
892
|
__decorate([
|
|
864
893
|
decorators_1.returnsPromise,
|
|
865
|
-
decorators_1.
|
|
866
|
-
decorators_1.
|
|
894
|
+
decorators_1.deprecated,
|
|
895
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Standalone]),
|
|
896
|
+
(0, decorators_1.apiVersions)([])
|
|
867
897
|
], Collection.prototype, "reIndex", null);
|
|
868
898
|
__decorate([
|
|
869
|
-
decorators_1.returnType('Database')
|
|
899
|
+
(0, decorators_1.returnType)('Database')
|
|
870
900
|
], Collection.prototype, "getDB", null);
|
|
871
901
|
__decorate([
|
|
872
|
-
decorators_1.returnType('Mongo')
|
|
902
|
+
(0, decorators_1.returnType)('Mongo')
|
|
873
903
|
], Collection.prototype, "getMongo", null);
|
|
874
904
|
__decorate([
|
|
875
905
|
decorators_1.returnsPromise,
|
|
876
|
-
decorators_1.apiVersions([])
|
|
906
|
+
(0, decorators_1.apiVersions)([])
|
|
877
907
|
], Collection.prototype, "dataSize", null);
|
|
878
908
|
__decorate([
|
|
879
909
|
decorators_1.returnsPromise,
|
|
880
|
-
decorators_1.apiVersions([])
|
|
910
|
+
(0, decorators_1.apiVersions)([])
|
|
881
911
|
], Collection.prototype, "storageSize", null);
|
|
882
912
|
__decorate([
|
|
883
913
|
decorators_1.returnsPromise,
|
|
884
|
-
decorators_1.apiVersions([])
|
|
914
|
+
(0, decorators_1.apiVersions)([])
|
|
885
915
|
], Collection.prototype, "totalSize", null);
|
|
886
916
|
__decorate([
|
|
887
917
|
decorators_1.returnsPromise,
|
|
888
|
-
decorators_1.apiVersions([1])
|
|
918
|
+
(0, decorators_1.apiVersions)([1])
|
|
889
919
|
], Collection.prototype, "drop", null);
|
|
890
920
|
__decorate([
|
|
891
921
|
decorators_1.returnsPromise,
|
|
892
|
-
decorators_1.apiVersions([1])
|
|
922
|
+
(0, decorators_1.apiVersions)([1])
|
|
893
923
|
], Collection.prototype, "exists", null);
|
|
894
924
|
__decorate([
|
|
895
925
|
decorators_1.returnsPromise,
|
|
896
|
-
decorators_1.apiVersions([1])
|
|
926
|
+
(0, decorators_1.apiVersions)([1])
|
|
897
927
|
], Collection.prototype, "runCommand", null);
|
|
898
928
|
__decorate([
|
|
899
|
-
decorators_1.returnType('Explainable'),
|
|
900
|
-
decorators_1.apiVersions([1])
|
|
929
|
+
(0, decorators_1.returnType)('Explainable'),
|
|
930
|
+
(0, decorators_1.apiVersions)([1])
|
|
901
931
|
], Collection.prototype, "explain", null);
|
|
902
932
|
__decorate([
|
|
903
933
|
decorators_1.returnsPromise,
|
|
904
|
-
decorators_1.apiVersions([])
|
|
934
|
+
(0, decorators_1.apiVersions)([])
|
|
905
935
|
], Collection.prototype, "stats", null);
|
|
906
936
|
__decorate([
|
|
907
937
|
decorators_1.returnsPromise,
|
|
908
|
-
decorators_1.apiVersions([])
|
|
938
|
+
(0, decorators_1.apiVersions)([])
|
|
909
939
|
], Collection.prototype, "latencyStats", null);
|
|
910
940
|
__decorate([
|
|
911
941
|
decorators_1.returnsPromise,
|
|
912
|
-
decorators_1.returnType('Bulk'),
|
|
913
|
-
decorators_1.apiVersions([1])
|
|
942
|
+
(0, decorators_1.returnType)('Bulk'),
|
|
943
|
+
(0, decorators_1.apiVersions)([1])
|
|
914
944
|
], Collection.prototype, "initializeOrderedBulkOp", null);
|
|
915
945
|
__decorate([
|
|
916
946
|
decorators_1.returnsPromise,
|
|
917
|
-
decorators_1.returnType('Bulk'),
|
|
918
|
-
decorators_1.apiVersions([1])
|
|
947
|
+
(0, decorators_1.returnType)('Bulk'),
|
|
948
|
+
(0, decorators_1.apiVersions)([1])
|
|
919
949
|
], Collection.prototype, "initializeUnorderedBulkOp", null);
|
|
920
950
|
__decorate([
|
|
921
|
-
decorators_1.returnType('PlanCache'),
|
|
922
|
-
decorators_1.apiVersions([])
|
|
951
|
+
(0, decorators_1.returnType)('PlanCache'),
|
|
952
|
+
(0, decorators_1.apiVersions)([])
|
|
923
953
|
], Collection.prototype, "getPlanCache", null);
|
|
924
954
|
__decorate([
|
|
925
955
|
decorators_1.returnsPromise,
|
|
926
956
|
decorators_1.deprecated,
|
|
927
|
-
decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.9.0']),
|
|
928
|
-
decorators_1.apiVersions([])
|
|
957
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.9.0']),
|
|
958
|
+
(0, decorators_1.apiVersions)([])
|
|
929
959
|
], Collection.prototype, "mapReduce", null);
|
|
930
960
|
__decorate([
|
|
931
961
|
decorators_1.returnsPromise,
|
|
932
|
-
decorators_1.apiVersions([])
|
|
962
|
+
(0, decorators_1.apiVersions)([])
|
|
933
963
|
], Collection.prototype, "validate", null);
|
|
934
964
|
__decorate([
|
|
935
965
|
decorators_1.returnsPromise,
|
|
936
|
-
decorators_1.topologies([enums_1.Topologies.Sharded]),
|
|
937
|
-
decorators_1.apiVersions([])
|
|
966
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
|
|
967
|
+
(0, decorators_1.apiVersions)([])
|
|
938
968
|
], Collection.prototype, "getShardVersion", null);
|
|
939
969
|
__decorate([
|
|
940
970
|
decorators_1.returnsPromise,
|
|
941
|
-
decorators_1.topologies([enums_1.Topologies.Sharded]),
|
|
942
|
-
decorators_1.apiVersions([])
|
|
971
|
+
(0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
|
|
972
|
+
(0, decorators_1.apiVersions)([])
|
|
943
973
|
], Collection.prototype, "getShardDistribution", null);
|
|
944
974
|
__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]),
|
|
975
|
+
(0, decorators_1.serverVersions)(['3.1.0', enums_1.ServerVersions.latest]),
|
|
976
|
+
(0, decorators_1.topologies)([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
|
|
977
|
+
(0, decorators_1.apiVersions)([1]),
|
|
948
978
|
decorators_1.returnsPromise
|
|
949
979
|
], Collection.prototype, "watch", null);
|
|
950
980
|
__decorate([
|
|
951
|
-
decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
|
|
981
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
952
982
|
decorators_1.returnsPromise,
|
|
953
|
-
decorators_1.apiVersions([1])
|
|
983
|
+
(0, decorators_1.apiVersions)([1])
|
|
954
984
|
], Collection.prototype, "hideIndex", null);
|
|
955
985
|
__decorate([
|
|
956
|
-
decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
|
|
986
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
957
987
|
decorators_1.returnsPromise,
|
|
958
|
-
decorators_1.apiVersions([1])
|
|
988
|
+
(0, decorators_1.apiVersions)([1])
|
|
959
989
|
], Collection.prototype, "unhideIndex", null);
|
|
960
990
|
Collection = __decorate([
|
|
961
991
|
decorators_1.shellApiClassDefault,
|