@mongosh/shell-api 1.3.0 → 1.3.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/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,57 +176,57 @@ 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);
@@ -237,14 +237,14 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
237
237
  }
238
238
  async remove(query, options = {}) {
239
239
  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);
240
+ (0, helpers_1.assertArgsDefinedType)([query], [true], 'Collection.remove');
241
+ const removeOptions = (0, helpers_1.processRemoveOptions)(options);
242
242
  const method = removeOptions.justOne ? 'deleteOne' : 'deleteMany';
243
243
  delete removeOptions.justOne;
244
244
  this._emitCollectionApiCall('remove', { query, removeOptions });
245
245
  const result = await this._mongo._serviceProvider[method](this._database._name, this._name, query, { ...await this._database._baseOptions(), ...removeOptions });
246
246
  if (removeOptions.explain) {
247
- return helpers_1.markAsExplainOutput(result);
247
+ return (0, helpers_1.markAsExplainOutput)(result);
248
248
  }
249
249
  return new index_1.DeleteResult(!!result.acknowledged, result.deletedCount);
250
250
  }
@@ -252,14 +252,14 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
252
252
  throw new errors_1.MongoshInvalidInputError('Collection.save() is deprecated. Use insertOne, insertMany, updateOne, or updateMany.');
253
253
  }
254
254
  async replaceOne(filter, replacement, options = {}) {
255
- helpers_1.assertArgsDefinedType([filter], [true], 'Collection.replaceOne');
255
+ (0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.replaceOne');
256
256
  this._emitCollectionApiCall('replaceOne', { filter, options });
257
257
  const result = await this._mongo._serviceProvider.replaceOne(this._database._name, this._name, filter, replacement, { ...await this._database._baseOptions(), ...options });
258
258
  return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
259
259
  }
260
260
  async update(filter, update, options = {}) {
261
261
  await this._instanceState.printDeprecationWarning('Collection.update() is deprecated. Use updateOne, updateMany, or bulkWrite.');
262
- helpers_1.assertArgsDefinedType([filter, update], [true, true], 'Collection.update');
262
+ (0, helpers_1.assertArgsDefinedType)([filter, update], [true, true], 'Collection.update');
263
263
  this._emitCollectionApiCall('update', { filter, options });
264
264
  let result;
265
265
  if (options.multi) {
@@ -269,25 +269,25 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
269
269
  result = await this._mongo._serviceProvider.updateOne(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
270
270
  }
271
271
  if (options.explain) {
272
- return helpers_1.markAsExplainOutput(result);
272
+ return (0, helpers_1.markAsExplainOutput)(result);
273
273
  }
274
274
  return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
275
275
  }
276
276
  async updateMany(filter, update, options = {}) {
277
- helpers_1.assertArgsDefinedType([filter], [true], 'Collection.updateMany');
277
+ (0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.updateMany');
278
278
  this._emitCollectionApiCall('updateMany', { filter, options });
279
279
  const result = await this._mongo._serviceProvider.updateMany(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
280
280
  if (options.explain) {
281
- return helpers_1.markAsExplainOutput(result);
281
+ return (0, helpers_1.markAsExplainOutput)(result);
282
282
  }
283
283
  return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
284
284
  }
285
285
  async updateOne(filter, update, options = {}) {
286
- helpers_1.assertArgsDefinedType([filter], [true], 'Collection.updateOne');
286
+ (0, helpers_1.assertArgsDefinedType)([filter], [true], 'Collection.updateOne');
287
287
  this._emitCollectionApiCall('updateOne', { filter, options });
288
288
  const result = await this._mongo._serviceProvider.updateOne(this._database._name, this._name, filter, update, { ...await this._database._baseOptions(), ...options });
289
289
  if (options.explain) {
290
- return helpers_1.markAsExplainOutput(result);
290
+ return (0, helpers_1.markAsExplainOutput)(result);
291
291
  }
292
292
  return new index_1.UpdateResult(!!result.acknowledged, result.matchedCount, result.modifiedCount, result.upsertedCount, result.upsertedId);
293
293
  }
@@ -299,7 +299,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
299
299
  });
300
300
  }
301
301
  async _createIndexes(keyPatterns, options = {}, commitQuorum) {
302
- helpers_1.assertArgsDefinedType([keyPatterns], [true], 'Collection.createIndexes');
302
+ (0, helpers_1.assertArgsDefinedType)([keyPatterns], [true], 'Collection.createIndexes');
303
303
  if (typeof options !== 'object' || Array.isArray(options)) {
304
304
  throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
305
305
  }
@@ -320,7 +320,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
320
320
  return this._createIndexes(keyPatterns, options, commitQuorum);
321
321
  }
322
322
  async createIndex(keys, options = {}, commitQuorum) {
323
- helpers_1.assertArgsDefinedType([keys], [true], 'Collection.createIndex');
323
+ (0, helpers_1.assertArgsDefinedType)([keys], [true], 'Collection.createIndex');
324
324
  if (typeof options !== 'object' || Array.isArray(options)) {
325
325
  throw new errors_1.MongoshInvalidInputError('The "options" argument must be an object.', errors_1.CommonErrors.InvalidArgument);
326
326
  }
@@ -361,8 +361,8 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
361
361
  });
362
362
  }
363
363
  catch (error) {
364
- if ((error.codeName === 'IndexNotFound' || error.codeName === undefined) &&
365
- (error.errmsg === 'invalid index name spec' || error.errmsg === undefined) &&
364
+ if (((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound' || (error === null || error === void 0 ? void 0 : error.codeName) === undefined) &&
365
+ ((error === null || error === void 0 ? void 0 : error.errmsg) === 'invalid index name spec' || (error === null || error === void 0 ? void 0 : error.errmsg) === undefined) &&
366
366
  Array.isArray(indexes) &&
367
367
  indexes.length > 0 &&
368
368
  (await this._database.version()).match(/^4\.0\./)) {
@@ -372,7 +372,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
372
372
  return errored;
373
373
  return all.sort((a, b) => b.nIndexesWas - a.nIndexesWas)[0];
374
374
  }
375
- if (error.codeName === 'IndexNotFound') {
375
+ if ((error === null || error === void 0 ? void 0 : error.codeName) === 'IndexNotFound') {
376
376
  return {
377
377
  ok: error.ok,
378
378
  errmsg: error.errmsg,
@@ -384,7 +384,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
384
384
  }
385
385
  }
386
386
  async dropIndex(index) {
387
- helpers_1.assertArgsDefinedType([index], [true], 'Collection.dropIndex');
387
+ (0, helpers_1.assertArgsDefinedType)([index], [true], 'Collection.dropIndex');
388
388
  this._emitCollectionApiCall('dropIndex', { index });
389
389
  if (index === '*') {
390
390
  throw new errors_1.MongoshInvalidInputError('To drop indexes in the collection using \'*\', use db.collection.dropIndexes().', errors_1.CommonErrors.InvalidArgument);
@@ -437,7 +437,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
437
437
  return await this._mongo._serviceProvider.dropCollection(this._database._name, this._name, await this._database._baseOptions());
438
438
  }
439
439
  catch (error) {
440
- if (error.codeName === 'NamespaceNotFound') {
440
+ if ((error === null || error === void 0 ? void 0 : error.codeName) === 'NamespaceNotFound') {
441
441
  this._mongo._instanceState.messageBus.emit('mongosh:warn', {
442
442
  method: 'drop',
443
443
  class: 'Collection',
@@ -464,7 +464,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
464
464
  return `${this._name}`;
465
465
  }
466
466
  async runCommand(commandName, options) {
467
- helpers_1.assertArgsDefinedType([commandName], [['string', 'object']], 'Collection.runCommand');
467
+ (0, helpers_1.assertArgsDefinedType)([commandName], [['string', 'object']], 'Collection.runCommand');
468
468
  if (options) {
469
469
  if (typeof commandName !== 'string') {
470
470
  throw new errors_1.MongoshInvalidInputError('Collection.runCommand takes a command string as its first arugment', errors_1.CommonErrors.InvalidArgument);
@@ -484,7 +484,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
484
484
  return await this._database._runCommand(cmd);
485
485
  }
486
486
  explain(verbosity = 'queryPlanner') {
487
- verbosity = helpers_1.validateExplainableVerbosity(verbosity);
487
+ verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
488
488
  this._emitCollectionApiCall('explain', { verbosity });
489
489
  return new index_1.Explainable(this._mongo, this, verbosity);
490
490
  }
@@ -564,13 +564,13 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
564
564
  }
565
565
  async mapReduce(map, reduce, optionsOrOutString) {
566
566
  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');
567
+ (0, helpers_1.assertArgsDefinedType)([map, reduce, optionsOrOutString], [true, true, true], 'Collection.mapReduce');
568
568
  this._emitCollectionApiCall('mapReduce', { map, reduce, out: optionsOrOutString });
569
569
  let cmd = {
570
570
  mapReduce: this._name,
571
571
  map: map,
572
572
  reduce: reduce,
573
- ...helpers_1.processMapReduceOptions(optionsOrOutString)
573
+ ...(0, helpers_1.processMapReduceOptions)(optionsOrOutString)
574
574
  };
575
575
  if (cmd.explain) {
576
576
  const verbosity = cmd.explain;
@@ -634,10 +634,10 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
634
634
  const estChunkData = (shardStats.numChunks === 0) ? 0 : (shardStats.size / shardStats.numChunks);
635
635
  const estChunkCount = (shardStats.numChunks === 0) ? 0 : Math.floor(shardStats.count / shardStats.numChunks);
636
636
  result[key] = {
637
- data: helpers_1.dataFormat(shardStats.size),
637
+ data: (0, helpers_1.dataFormat)(shardStats.size),
638
638
  docs: shardStats.count,
639
639
  chunks: shardStats.numChunks,
640
- 'estimated data per chunk': helpers_1.dataFormat(estChunkData),
640
+ 'estimated data per chunk': (0, helpers_1.dataFormat)(estChunkData),
641
641
  'estimated docs per chunk': estChunkCount
642
642
  };
643
643
  totals.size += shardStats.size;
@@ -646,7 +646,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
646
646
  conciseShardsStats.push(shardStats);
647
647
  })())));
648
648
  const totalValue = {
649
- data: helpers_1.dataFormat(totals.size),
649
+ data: (0, helpers_1.dataFormat)(totals.size),
650
650
  docs: totals.count,
651
651
  chunks: totals.numChunks
652
652
  };
@@ -656,7 +656,7 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
656
656
  totalValue[`Shard ${shardStats.shardId}`] = [
657
657
  `${estDataPercent} % data`,
658
658
  `${estDocPercent} % docs in cluster`,
659
- `${helpers_1.dataFormat(shardStats.avgObjSize)} avg obj size on shard`
659
+ `${(0, helpers_1.dataFormat)(shardStats.avgObjSize)} avg obj size on shard`
660
660
  ];
661
661
  }
662
662
  result.Totals = totalValue;
@@ -680,282 +680,282 @@ let Collection = class Collection extends decorators_1.ShellApiWithMongoClass {
680
680
  }
681
681
  async hideIndex(index) {
682
682
  this._emitCollectionApiCall('hideIndex');
683
- return helpers_1.setHideIndex(this, index, true);
683
+ return (0, helpers_1.setHideIndex)(this, index, true);
684
684
  }
685
685
  async unhideIndex(index) {
686
686
  this._emitCollectionApiCall('unhideIndex');
687
- return helpers_1.setHideIndex(this, index, false);
687
+ return (0, helpers_1.setHideIndex)(this, index, false);
688
688
  }
689
689
  };
690
690
  __decorate([
691
691
  decorators_1.returnsPromise,
692
- decorators_1.returnType('AggregationCursor'),
693
- decorators_1.apiVersions([1])
692
+ (0, decorators_1.returnType)('AggregationCursor'),
693
+ (0, decorators_1.apiVersions)([1])
694
694
  ], Collection.prototype, "aggregate", null);
695
695
  __decorate([
696
696
  decorators_1.returnsPromise,
697
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
698
- decorators_1.apiVersions([1])
697
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
698
+ (0, decorators_1.apiVersions)([1])
699
699
  ], Collection.prototype, "bulkWrite", null);
700
700
  __decorate([
701
701
  decorators_1.returnsPromise,
702
702
  decorators_1.deprecated,
703
- decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.0.0']),
704
- decorators_1.apiVersions([])
703
+ (0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0']),
704
+ (0, decorators_1.apiVersions)([])
705
705
  ], Collection.prototype, "count", null);
706
706
  __decorate([
707
707
  decorators_1.returnsPromise,
708
- decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
709
- decorators_1.apiVersions([1])
708
+ (0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
709
+ (0, decorators_1.apiVersions)([1])
710
710
  ], Collection.prototype, "countDocuments", null);
711
711
  __decorate([
712
712
  decorators_1.returnsPromise,
713
- decorators_1.apiVersions([1])
713
+ (0, decorators_1.apiVersions)([1])
714
714
  ], Collection.prototype, "deleteMany", null);
715
715
  __decorate([
716
716
  decorators_1.returnsPromise,
717
- decorators_1.apiVersions([1])
717
+ (0, decorators_1.apiVersions)([1])
718
718
  ], Collection.prototype, "deleteOne", null);
719
719
  __decorate([
720
720
  decorators_1.returnsPromise,
721
- decorators_1.apiVersions([])
721
+ (0, decorators_1.apiVersions)([])
722
722
  ], Collection.prototype, "distinct", null);
723
723
  __decorate([
724
724
  decorators_1.returnsPromise,
725
- decorators_1.serverVersions(['4.0.3', enums_1.ServerVersions.latest]),
726
- decorators_1.apiVersions([1])
725
+ (0, decorators_1.serverVersions)(['4.0.3', enums_1.ServerVersions.latest]),
726
+ (0, decorators_1.apiVersions)([1])
727
727
  ], Collection.prototype, "estimatedDocumentCount", null);
728
728
  __decorate([
729
- decorators_1.returnType('Cursor'),
730
- decorators_1.apiVersions([1]),
729
+ (0, decorators_1.returnType)('Cursor'),
730
+ (0, decorators_1.apiVersions)([1]),
731
731
  decorators_1.returnsPromise
732
732
  ], Collection.prototype, "find", null);
733
733
  __decorate([
734
734
  decorators_1.returnsPromise,
735
735
  decorators_1.deprecated,
736
- decorators_1.apiVersions([1])
736
+ (0, decorators_1.apiVersions)([1])
737
737
  ], Collection.prototype, "findAndModify", null);
738
738
  __decorate([
739
739
  decorators_1.returnsPromise,
740
- decorators_1.returnType('Document'),
741
- decorators_1.apiVersions([1])
740
+ (0, decorators_1.returnType)('Document'),
741
+ (0, decorators_1.apiVersions)([1])
742
742
  ], Collection.prototype, "findOne", null);
743
743
  __decorate([
744
744
  decorators_1.returnsPromise,
745
- decorators_1.apiVersions([])
745
+ (0, decorators_1.apiVersions)([])
746
746
  ], Collection.prototype, "renameCollection", null);
747
747
  __decorate([
748
748
  decorators_1.returnsPromise,
749
- decorators_1.returnType('Document'),
750
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
751
- decorators_1.apiVersions([1])
749
+ (0, decorators_1.returnType)('Document'),
750
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
751
+ (0, decorators_1.apiVersions)([1])
752
752
  ], Collection.prototype, "findOneAndDelete", null);
753
753
  __decorate([
754
754
  decorators_1.returnsPromise,
755
- decorators_1.returnType('Document'),
756
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
757
- decorators_1.apiVersions([1])
755
+ (0, decorators_1.returnType)('Document'),
756
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
757
+ (0, decorators_1.apiVersions)([1])
758
758
  ], Collection.prototype, "findOneAndReplace", null);
759
759
  __decorate([
760
760
  decorators_1.returnsPromise,
761
- decorators_1.returnType('Document'),
762
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
763
- decorators_1.apiVersions([1])
761
+ (0, decorators_1.returnType)('Document'),
762
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
763
+ (0, decorators_1.apiVersions)([1])
764
764
  ], Collection.prototype, "findOneAndUpdate", null);
765
765
  __decorate([
766
766
  decorators_1.returnsPromise,
767
767
  decorators_1.deprecated,
768
- decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.6.0']),
769
- decorators_1.apiVersions([1])
768
+ (0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.6.0']),
769
+ (0, decorators_1.apiVersions)([1])
770
770
  ], Collection.prototype, "insert", null);
771
771
  __decorate([
772
772
  decorators_1.returnsPromise,
773
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
774
- decorators_1.apiVersions([1])
773
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
774
+ (0, decorators_1.apiVersions)([1])
775
775
  ], Collection.prototype, "insertMany", null);
776
776
  __decorate([
777
777
  decorators_1.returnsPromise,
778
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
779
- decorators_1.apiVersions([1])
778
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
779
+ (0, decorators_1.apiVersions)([1])
780
780
  ], Collection.prototype, "insertOne", null);
781
781
  __decorate([
782
782
  decorators_1.returnsPromise,
783
- decorators_1.apiVersions([1])
783
+ (0, decorators_1.apiVersions)([1])
784
784
  ], Collection.prototype, "isCapped", null);
785
785
  __decorate([
786
786
  decorators_1.returnsPromise,
787
787
  decorators_1.deprecated,
788
- decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
789
- decorators_1.apiVersions([1])
788
+ (0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
789
+ (0, decorators_1.apiVersions)([1])
790
790
  ], Collection.prototype, "remove", null);
791
791
  __decorate([
792
792
  decorators_1.deprecated
793
793
  ], Collection.prototype, "save", null);
794
794
  __decorate([
795
795
  decorators_1.returnsPromise,
796
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
797
- decorators_1.apiVersions([1])
796
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
797
+ (0, decorators_1.apiVersions)([1])
798
798
  ], Collection.prototype, "replaceOne", null);
799
799
  __decorate([
800
800
  decorators_1.returnsPromise,
801
801
  decorators_1.deprecated,
802
- decorators_1.serverVersions([enums_1.ServerVersions.earliest, '3.2.0']),
803
- decorators_1.apiVersions([1])
802
+ (0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0']),
803
+ (0, decorators_1.apiVersions)([1])
804
804
  ], Collection.prototype, "update", null);
805
805
  __decorate([
806
806
  decorators_1.returnsPromise,
807
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
808
- decorators_1.apiVersions([1])
807
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
808
+ (0, decorators_1.apiVersions)([1])
809
809
  ], Collection.prototype, "updateMany", null);
810
810
  __decorate([
811
811
  decorators_1.returnsPromise,
812
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
813
- decorators_1.apiVersions([1])
812
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
813
+ (0, decorators_1.apiVersions)([1])
814
814
  ], Collection.prototype, "updateOne", null);
815
815
  __decorate([
816
816
  decorators_1.returnsPromise,
817
- decorators_1.apiVersions([])
817
+ (0, decorators_1.apiVersions)([])
818
818
  ], Collection.prototype, "convertToCapped", null);
819
819
  __decorate([
820
820
  decorators_1.returnsPromise,
821
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
822
- decorators_1.apiVersions([1])
821
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
822
+ (0, decorators_1.apiVersions)([1])
823
823
  ], Collection.prototype, "createIndexes", null);
824
824
  __decorate([
825
825
  decorators_1.returnsPromise,
826
- decorators_1.apiVersions([1])
826
+ (0, decorators_1.apiVersions)([1])
827
827
  ], Collection.prototype, "createIndex", null);
828
828
  __decorate([
829
829
  decorators_1.returnsPromise,
830
- decorators_1.apiVersions([1])
830
+ (0, decorators_1.apiVersions)([1])
831
831
  ], Collection.prototype, "ensureIndex", null);
832
832
  __decorate([
833
833
  decorators_1.returnsPromise,
834
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
835
- decorators_1.apiVersions([1])
834
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
835
+ (0, decorators_1.apiVersions)([1])
836
836
  ], Collection.prototype, "getIndexes", null);
837
837
  __decorate([
838
838
  decorators_1.returnsPromise,
839
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
840
- decorators_1.apiVersions([1])
839
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
840
+ (0, decorators_1.apiVersions)([1])
841
841
  ], Collection.prototype, "getIndexSpecs", null);
842
842
  __decorate([
843
843
  decorators_1.returnsPromise,
844
- decorators_1.apiVersions([1])
844
+ (0, decorators_1.apiVersions)([1])
845
845
  ], Collection.prototype, "getIndices", null);
846
846
  __decorate([
847
847
  decorators_1.returnsPromise,
848
- decorators_1.serverVersions(['3.2.0', enums_1.ServerVersions.latest]),
849
- decorators_1.apiVersions([1])
848
+ (0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
849
+ (0, decorators_1.apiVersions)([1])
850
850
  ], Collection.prototype, "getIndexKeys", null);
851
851
  __decorate([
852
852
  decorators_1.returnsPromise,
853
- decorators_1.apiVersions([1])
853
+ (0, decorators_1.apiVersions)([1])
854
854
  ], Collection.prototype, "dropIndexes", null);
855
855
  __decorate([
856
856
  decorators_1.returnsPromise,
857
- decorators_1.apiVersions([1])
857
+ (0, decorators_1.apiVersions)([1])
858
858
  ], Collection.prototype, "dropIndex", null);
859
859
  __decorate([
860
860
  decorators_1.returnsPromise,
861
- decorators_1.apiVersions([])
861
+ (0, decorators_1.apiVersions)([])
862
862
  ], Collection.prototype, "totalIndexSize", null);
863
863
  __decorate([
864
864
  decorators_1.returnsPromise,
865
- decorators_1.topologies([enums_1.Topologies.Standalone]),
866
- decorators_1.apiVersions([])
865
+ (0, decorators_1.topologies)([enums_1.Topologies.Standalone]),
866
+ (0, decorators_1.apiVersions)([])
867
867
  ], Collection.prototype, "reIndex", null);
868
868
  __decorate([
869
- decorators_1.returnType('Database')
869
+ (0, decorators_1.returnType)('Database')
870
870
  ], Collection.prototype, "getDB", null);
871
871
  __decorate([
872
- decorators_1.returnType('Mongo')
872
+ (0, decorators_1.returnType)('Mongo')
873
873
  ], Collection.prototype, "getMongo", null);
874
874
  __decorate([
875
875
  decorators_1.returnsPromise,
876
- decorators_1.apiVersions([])
876
+ (0, decorators_1.apiVersions)([])
877
877
  ], Collection.prototype, "dataSize", null);
878
878
  __decorate([
879
879
  decorators_1.returnsPromise,
880
- decorators_1.apiVersions([])
880
+ (0, decorators_1.apiVersions)([])
881
881
  ], Collection.prototype, "storageSize", null);
882
882
  __decorate([
883
883
  decorators_1.returnsPromise,
884
- decorators_1.apiVersions([])
884
+ (0, decorators_1.apiVersions)([])
885
885
  ], Collection.prototype, "totalSize", null);
886
886
  __decorate([
887
887
  decorators_1.returnsPromise,
888
- decorators_1.apiVersions([1])
888
+ (0, decorators_1.apiVersions)([1])
889
889
  ], Collection.prototype, "drop", null);
890
890
  __decorate([
891
891
  decorators_1.returnsPromise,
892
- decorators_1.apiVersions([1])
892
+ (0, decorators_1.apiVersions)([1])
893
893
  ], Collection.prototype, "exists", null);
894
894
  __decorate([
895
895
  decorators_1.returnsPromise,
896
- decorators_1.apiVersions([1])
896
+ (0, decorators_1.apiVersions)([1])
897
897
  ], Collection.prototype, "runCommand", null);
898
898
  __decorate([
899
- decorators_1.returnType('Explainable'),
900
- decorators_1.apiVersions([1])
899
+ (0, decorators_1.returnType)('Explainable'),
900
+ (0, decorators_1.apiVersions)([1])
901
901
  ], Collection.prototype, "explain", null);
902
902
  __decorate([
903
903
  decorators_1.returnsPromise,
904
- decorators_1.apiVersions([])
904
+ (0, decorators_1.apiVersions)([])
905
905
  ], Collection.prototype, "stats", null);
906
906
  __decorate([
907
907
  decorators_1.returnsPromise,
908
- decorators_1.apiVersions([])
908
+ (0, decorators_1.apiVersions)([])
909
909
  ], Collection.prototype, "latencyStats", null);
910
910
  __decorate([
911
911
  decorators_1.returnsPromise,
912
- decorators_1.returnType('Bulk'),
913
- decorators_1.apiVersions([1])
912
+ (0, decorators_1.returnType)('Bulk'),
913
+ (0, decorators_1.apiVersions)([1])
914
914
  ], Collection.prototype, "initializeOrderedBulkOp", null);
915
915
  __decorate([
916
916
  decorators_1.returnsPromise,
917
- decorators_1.returnType('Bulk'),
918
- decorators_1.apiVersions([1])
917
+ (0, decorators_1.returnType)('Bulk'),
918
+ (0, decorators_1.apiVersions)([1])
919
919
  ], Collection.prototype, "initializeUnorderedBulkOp", null);
920
920
  __decorate([
921
- decorators_1.returnType('PlanCache'),
922
- decorators_1.apiVersions([])
921
+ (0, decorators_1.returnType)('PlanCache'),
922
+ (0, decorators_1.apiVersions)([])
923
923
  ], Collection.prototype, "getPlanCache", null);
924
924
  __decorate([
925
925
  decorators_1.returnsPromise,
926
926
  decorators_1.deprecated,
927
- decorators_1.serverVersions([enums_1.ServerVersions.earliest, '4.9.0']),
928
- decorators_1.apiVersions([])
927
+ (0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.9.0']),
928
+ (0, decorators_1.apiVersions)([])
929
929
  ], Collection.prototype, "mapReduce", null);
930
930
  __decorate([
931
931
  decorators_1.returnsPromise,
932
- decorators_1.apiVersions([])
932
+ (0, decorators_1.apiVersions)([])
933
933
  ], Collection.prototype, "validate", null);
934
934
  __decorate([
935
935
  decorators_1.returnsPromise,
936
- decorators_1.topologies([enums_1.Topologies.Sharded]),
937
- decorators_1.apiVersions([])
936
+ (0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
937
+ (0, decorators_1.apiVersions)([])
938
938
  ], Collection.prototype, "getShardVersion", null);
939
939
  __decorate([
940
940
  decorators_1.returnsPromise,
941
- decorators_1.topologies([enums_1.Topologies.Sharded]),
942
- decorators_1.apiVersions([])
941
+ (0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
942
+ (0, decorators_1.apiVersions)([])
943
943
  ], Collection.prototype, "getShardDistribution", null);
944
944
  __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]),
945
+ (0, decorators_1.serverVersions)(['3.1.0', enums_1.ServerVersions.latest]),
946
+ (0, decorators_1.topologies)([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
947
+ (0, decorators_1.apiVersions)([1]),
948
948
  decorators_1.returnsPromise
949
949
  ], Collection.prototype, "watch", null);
950
950
  __decorate([
951
- decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
951
+ (0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
952
952
  decorators_1.returnsPromise,
953
- decorators_1.apiVersions([1])
953
+ (0, decorators_1.apiVersions)([1])
954
954
  ], Collection.prototype, "hideIndex", null);
955
955
  __decorate([
956
- decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
956
+ (0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
957
957
  decorators_1.returnsPromise,
958
- decorators_1.apiVersions([1])
958
+ (0, decorators_1.apiVersions)([1])
959
959
  ], Collection.prototype, "unhideIndex", null);
960
960
  Collection = __decorate([
961
961
  decorators_1.shellApiClassDefault,