mongodb-data-service 22.6.0 → 22.7.0

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.
@@ -61,19 +61,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
61
61
  };
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.DataServiceImpl = void 0;
64
- const compass_logging_1 = __importDefault(require("@mongodb-js/compass-logging"));
65
64
  const events_1 = require("events");
66
65
  const mongodb_connection_string_url_1 = __importDefault(require("mongodb-connection-string-url"));
67
66
  const mongodb_ns_1 = __importDefault(require("mongodb-ns"));
68
67
  const instance_detail_helper_1 = require("./instance-detail-helper");
69
68
  const instance_detail_helper_2 = require("./instance-detail-helper");
70
69
  const redact_1 = require("./redact");
71
- const connect_mongo_client_1 = __importStar(require("./connect-mongo-client"));
70
+ const connect_mongo_client_1 = require("./connect-mongo-client");
72
71
  const run_command_1 = require("./run-command");
73
72
  const csfle_collection_tracker_1 = require("./csfle-collection-tracker");
74
73
  const mongodb = __importStar(require("mongodb"));
75
74
  const compass_utils_1 = require("@mongodb-js/compass-utils");
76
75
  const index_detail_helper_1 = require("./index-detail-helper");
76
+ const logger_1 = require("./logger");
77
+ const lodash_1 = require("lodash");
77
78
  let ClientEncryption;
78
79
  try {
79
80
  const { extension } = require('mongodb-client-encryption');
@@ -82,7 +83,6 @@ try {
82
83
  catch (e) {
83
84
  console.warn(e);
84
85
  }
85
- const { log, mongoLogId, debug } = (0, compass_logging_1.default)('COMPASS-DATA-SERVICE');
86
86
  function uniqueBy(values, key) {
87
87
  return Array.from(new Map(values.map((val) => [val[key], val])).values());
88
88
  }
@@ -108,20 +108,18 @@ const translateErrorMessage = (error) => {
108
108
  }
109
109
  return error;
110
110
  };
111
- class WithLogContext {
112
- }
113
111
  function op(logId, pickLogAttrs = maybePickNs) {
114
112
  return function (target, context) {
115
113
  const opName = String(context.name);
116
114
  return function (...args) {
117
115
  const handleResult = (result) => {
118
- log.info(logId, this._logCtx(), `Running ${opName}`, pickLogAttrs(args, result));
116
+ this._logger.info(logId, `Running ${opName}`, pickLogAttrs(args, result));
119
117
  return result;
120
118
  };
121
119
  const handleError = (error) => {
122
120
  var _a;
123
121
  const err = translateErrorMessage(error);
124
- log.error(mongoLogId(1001000058), this._logCtx(), 'Failed to perform data service operation', {
122
+ this._logger.error((0, logger_1.mongoLogId)(1001000058), 'Failed to perform data service operation', {
125
123
  op: opName,
126
124
  message: err,
127
125
  ...((_a = pickLogAttrs(args)) !== null && _a !== void 0 ? _a : {}),
@@ -167,6 +165,8 @@ let DataServiceImpl = (() => {
167
165
  let _findCursor_decorators;
168
166
  let _findOneAndReplace_decorators;
169
167
  let _findOneAndUpdate_decorators;
168
+ let _updateOne_decorators;
169
+ let _replaceOne_decorators;
170
170
  let _explainFind_decorators;
171
171
  let _explainAggregate_decorators;
172
172
  let _indexes_decorators;
@@ -180,8 +180,8 @@ let DataServiceImpl = (() => {
180
180
  let _createView_decorators;
181
181
  let _databaseStats_decorators;
182
182
  let _createDataKey_decorators;
183
- return _a = class DataServiceImpl extends WithLogContext {
184
- constructor(connectionOptions) {
183
+ return _a = class DataServiceImpl extends logger_1.WithLogContext {
184
+ constructor(connectionOptions, logger) {
185
185
  super();
186
186
  this._connectionOptions = (__runInitializers(this, _instanceExtraInitializers), void 0);
187
187
  this._isConnecting = false;
@@ -191,6 +191,28 @@ let DataServiceImpl = (() => {
191
191
  this._emitter = new events_1.EventEmitter();
192
192
  this._id = id++;
193
193
  this._connectionOptions = connectionOptions;
194
+ const logComponent = 'COMPASS-DATA-SERVICE';
195
+ const logCtx = `Connection ${this._id}`;
196
+ this._logger = {
197
+ debug: (logId, ...args) => {
198
+ return logger === null || logger === void 0 ? void 0 : logger.debug(logComponent, logId, logCtx, ...args);
199
+ },
200
+ info: (logId, ...args) => {
201
+ return logger === null || logger === void 0 ? void 0 : logger.info(logComponent, logId, logCtx, ...args);
202
+ },
203
+ warn: (logId, ...args) => {
204
+ return logger === null || logger === void 0 ? void 0 : logger.warn(logComponent, logId, logCtx, ...args);
205
+ },
206
+ error: (logId, ...args) => {
207
+ return logger === null || logger === void 0 ? void 0 : logger.error(logComponent, logId, logCtx, ...args);
208
+ },
209
+ fatal: (logId, ...args) => {
210
+ return logger === null || logger === void 0 ? void 0 : logger.fatal(logComponent, logId, logCtx, ...args);
211
+ },
212
+ };
213
+ if (logger) {
214
+ this._unboundLogger = Object.assign(logger, { mongoLogId: logger_1.mongoLogId });
215
+ }
194
216
  }
195
217
  on(...args) {
196
218
  this._emitter.on(...args);
@@ -201,10 +223,7 @@ let DataServiceImpl = (() => {
201
223
  return this;
202
224
  }
203
225
  getMongoClientConnectionOptions() {
204
- return this._mongoClientConnectionOptions;
205
- }
206
- _logCtx() {
207
- return `Connection ${this._id}`;
226
+ return (0, lodash_1.omit)(this._mongoClientConnectionOptions, 'options.oidc.notifyDeviceFlow', 'options.oidc.signal');
208
227
  }
209
228
  getConnectionOptions() {
210
229
  return this._connectionOptions;
@@ -213,7 +232,7 @@ let DataServiceImpl = (() => {
213
232
  return new mongodb_connection_string_url_1.default(this._connectionOptions.connectionString);
214
233
  }
215
234
  setCSFLEEnabled(enabled) {
216
- log.info(mongoLogId(1001000117), this._logCtx(), 'Setting CSFLE mode', {
235
+ this._logger.info((0, logger_1.mongoLogId)(1001000117), 'Setting CSFLE mode', {
217
236
  enabled,
218
237
  });
219
238
  this._useCRUDClient = enabled;
@@ -232,10 +251,58 @@ let DataServiceImpl = (() => {
232
251
  }
233
252
  }
234
253
  async collectionStats(databaseName, collectionName) {
235
- const db = this._database(databaseName, 'META');
254
+ const ns = `${databaseName}.${collectionName}`;
236
255
  try {
237
- const data = await (0, run_command_1.runCommand)(db, { collStats: collectionName });
238
- return this._buildCollectionStats(databaseName, collectionName, data);
256
+ const coll = this._collection(ns, 'CRUD');
257
+ const collStats = await coll
258
+ .aggregate([
259
+ { $collStats: { storageStats: {} } },
260
+ {
261
+ $group: {
262
+ _id: null,
263
+ capped: { $first: '$storageStats.capped' },
264
+ count: { $sum: '$storageStats.count' },
265
+ size: { $sum: { $toDouble: '$storageStats.size' } },
266
+ storageSize: {
267
+ $sum: { $toDouble: '$storageStats.storageSize' },
268
+ },
269
+ totalIndexSize: {
270
+ $sum: { $toDouble: '$storageStats.totalIndexSize' },
271
+ },
272
+ freeStorageSize: {
273
+ $sum: { $toDouble: '$storageStats.freeStorageSize' },
274
+ },
275
+ unscaledCollSize: {
276
+ $sum: {
277
+ $multiply: [
278
+ { $toDouble: '$storageStats.avgObjSize' },
279
+ { $toDouble: '$storageStats.count' },
280
+ ],
281
+ },
282
+ },
283
+ nindexes: { $max: '$storageStats.nindexes' },
284
+ },
285
+ },
286
+ {
287
+ $addFields: {
288
+ avgObjSize: {
289
+ $cond: {
290
+ if: { $ne: ['$count', 0] },
291
+ then: {
292
+ $divide: ['$unscaledCollSize', { $toDouble: '$count' }],
293
+ },
294
+ else: 0,
295
+ },
296
+ },
297
+ },
298
+ },
299
+ ])
300
+ .toArray();
301
+ if (!collStats || collStats[0] === undefined) {
302
+ throw new Error(`Error running $collStats aggregation stage on ${ns}`);
303
+ }
304
+ collStats[0].ns = ns;
305
+ return this._buildCollectionStats(databaseName, collectionName, collStats[0]);
239
306
  }
240
307
  catch (error) {
241
308
  if (!error.message.includes('is a view, not a collection')) {
@@ -298,7 +365,7 @@ let DataServiceImpl = (() => {
298
365
  return results;
299
366
  }
300
367
  catch (err) {
301
- log.warn(mongoLogId(1001000099), this._logCtx(), 'Failed to run listCollections', { message: err.message });
368
+ this._logger.warn((0, logger_1.mongoLogId)(1001000099), 'Failed to run listCollections', { message: err.message });
302
369
  return [];
303
370
  }
304
371
  }
@@ -327,7 +394,7 @@ let DataServiceImpl = (() => {
327
394
  return databases;
328
395
  }
329
396
  catch (err) {
330
- log.warn(mongoLogId(1001000098), this._logCtx(), 'Failed to run listDatabases', { message: err.message });
397
+ this._logger.warn((0, logger_1.mongoLogId)(1001000098), 'Failed to run listDatabases', { message: err.message });
331
398
  return [];
332
399
  }
333
400
  };
@@ -351,32 +418,33 @@ let DataServiceImpl = (() => {
351
418
  });
352
419
  return databases;
353
420
  }
354
- async connect() {
421
+ async connect(signal) {
355
422
  if (this._metadataClient) {
356
- debug('already connected');
423
+ (0, logger_1.debug)('already connected');
357
424
  return;
358
425
  }
359
426
  if (this._isConnecting) {
360
- debug('connect method called more than once');
427
+ (0, logger_1.debug)('connect method called more than once');
361
428
  return;
362
429
  }
363
- debug('connecting...');
430
+ (0, logger_1.debug)('connecting...');
364
431
  this._isConnecting = true;
365
- log.info(mongoLogId(1001000014), this._logCtx(), 'Connecting', {
432
+ this._logger.info((0, logger_1.mongoLogId)(1001000014), 'Connecting', {
366
433
  url: (0, redact_1.redactConnectionString)(this._connectionOptions.connectionString),
367
434
  csfle: this._csfleLogInformation(this._connectionOptions.fleOptions),
368
435
  });
369
436
  try {
370
- const [metadataClient, crudClient, tunnel, connectionOptions] = await (0, connect_mongo_client_1.default)(this._connectionOptions, this._setupListeners.bind(this));
437
+ const [metadataClient, crudClient, tunnel, state, connectionOptions] = await (0, connect_mongo_client_1.connectMongoClientCompass)(this._connectionOptions, this._setupListeners.bind(this), signal, this._unboundLogger);
371
438
  const attr = {
372
439
  isWritable: this.isWritable(),
373
440
  isMongos: this.isMongos(),
374
441
  };
375
- log.info(mongoLogId(1001000015), this._logCtx(), 'Connected', attr);
376
- debug('connected!', attr);
442
+ this._logger.info((0, logger_1.mongoLogId)(1001000015), 'Connected', attr);
443
+ (0, logger_1.debug)('connected!', attr);
377
444
  this._metadataClient = metadataClient;
378
445
  this._crudClient = crudClient;
379
446
  this._tunnel = tunnel;
447
+ this._state = state;
380
448
  this._mongoClientConnectionOptions = connectionOptions;
381
449
  this._csfleCollectionTracker = new csfle_collection_tracker_1.CSFLECollectionTrackerImpl(this, this._crudClient);
382
450
  }
@@ -418,19 +486,20 @@ let DataServiceImpl = (() => {
418
486
  return await coll.deleteMany(filter, options);
419
487
  }
420
488
  async disconnect() {
421
- var _a, _b, _c;
422
- log.info(mongoLogId(1001000016), this._logCtx(), 'Disconnecting');
489
+ var _a, _b, _c, _d;
490
+ this._logger.info((0, logger_1.mongoLogId)(1001000016), 'Disconnecting');
423
491
  try {
424
492
  await Promise.all([
425
- (_a = this._metadataClient) === null || _a === void 0 ? void 0 : _a.close(true).catch((err) => debug('failed to close MongoClient', err)),
493
+ (_a = this._metadataClient) === null || _a === void 0 ? void 0 : _a.close(true).catch((err) => (0, logger_1.debug)('failed to close MongoClient', err)),
426
494
  this._crudClient !== this._metadataClient &&
427
- ((_b = this._crudClient) === null || _b === void 0 ? void 0 : _b.close(true).catch((err) => debug('failed to close MongoClient', err))),
428
- (_c = this._tunnel) === null || _c === void 0 ? void 0 : _c.close().catch((err) => debug('failed to close tunnel', err)),
495
+ ((_b = this._crudClient) === null || _b === void 0 ? void 0 : _b.close(true).catch((err) => (0, logger_1.debug)('failed to close MongoClient', err))),
496
+ (_c = this._tunnel) === null || _c === void 0 ? void 0 : _c.close().catch((err) => (0, logger_1.debug)('failed to close tunnel', err)),
497
+ (_d = this._state) === null || _d === void 0 ? void 0 : _d.destroy().catch((err) => (0, logger_1.debug)('failed to destroy DevtoolsConnectionState', err)),
429
498
  ]);
430
499
  }
431
500
  finally {
432
501
  this._cleanup();
433
- log.info(mongoLogId(1001000017), this._logCtx(), 'Fully closed');
502
+ this._logger.info((0, logger_1.mongoLogId)(1001000017), 'Fully closed');
434
503
  }
435
504
  }
436
505
  async dropCollection(ns) {
@@ -499,6 +568,14 @@ let DataServiceImpl = (() => {
499
568
  const coll = this._collection(ns, 'CRUD');
500
569
  return (await coll.findOneAndUpdate(filter, update, options)).value;
501
570
  }
571
+ async updateOne(ns, filter, update, options) {
572
+ const coll = this._collection(ns, 'CRUD');
573
+ return await coll.updateOne(filter, update, options);
574
+ }
575
+ async replaceOne(ns, filter, replacement, options) {
576
+ const coll = this._collection(ns, 'CRUD');
577
+ return await coll.replaceOne(filter, replacement, options);
578
+ }
502
579
  explainFind(ns, filter, options = {}, executionOptions) {
503
580
  const verbosity = (executionOptions === null || executionOptions === void 0 ? void 0 : executionOptions.explainVerbosity) ||
504
581
  mongodb.ExplainVerbosity.allPlansExecution;
@@ -601,12 +678,19 @@ let DataServiceImpl = (() => {
601
678
  bulkWrite(ns, operations, options) {
602
679
  return this._collection(ns, 'CRUD').bulkWrite(operations, options);
603
680
  }
604
- async currentOp(includeAll) {
681
+ async currentOp() {
605
682
  const db = this._database('admin', 'META');
606
- return await (0, run_command_1.runCommand)(db, {
607
- currentOp: 1,
608
- $all: includeAll,
609
- });
683
+ const pipelineWithTruncateOps = [
684
+ {
685
+ $currentOp: {
686
+ allUsers: true,
687
+ idleConnections: false,
688
+ truncateOps: false,
689
+ },
690
+ },
691
+ ];
692
+ const currentOp = await db.aggregate(pipelineWithTruncateOps).toArray();
693
+ return { inprog: currentOp };
610
694
  }
611
695
  getLastSeenTopology() {
612
696
  return this._lastSeenTopology;
@@ -683,7 +767,7 @@ let DataServiceImpl = (() => {
683
767
  let result;
684
768
  const abort = async () => {
685
769
  const logAbortError = (error) => {
686
- log.warn(mongoLogId(1001000140), this._logCtx(), 'Attempting to kill the operation failed', { error: error.message });
770
+ this._logger.warn((0, logger_1.mongoLogId)(1001000140), 'Attempting to kill the operation failed', { error: error.message });
687
771
  };
688
772
  await stop(session).catch(logAbortError);
689
773
  await this._killSessions(session).catch(logAbortError);
@@ -706,7 +790,7 @@ let DataServiceImpl = (() => {
706
790
  if (client) {
707
791
  client.on('serverDescriptionChanged', (evt) => {
708
792
  var _a, _b;
709
- log.info(mongoLogId(1001000018), this._logCtx(), 'Server description changed', {
793
+ this._logger.info((0, logger_1.mongoLogId)(1001000018), 'Server description changed', {
710
794
  address: evt.address,
711
795
  error: (_b = (_a = evt.newDescription.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : null,
712
796
  previousType: evt.previousDescription.type,
@@ -714,12 +798,12 @@ let DataServiceImpl = (() => {
714
798
  });
715
799
  });
716
800
  client.on('serverOpening', (evt) => {
717
- log.info(mongoLogId(1001000019), this._logCtx(), 'Server opening', {
801
+ this._logger.info((0, logger_1.mongoLogId)(1001000019), 'Server opening', {
718
802
  address: evt.address,
719
803
  });
720
804
  });
721
805
  client.on('serverClosed', (evt) => {
722
- log.info(mongoLogId(1001000020), this._logCtx(), 'Server closed', {
806
+ this._logger.info((0, logger_1.mongoLogId)(1001000020), 'Server closed', {
723
807
  address: evt.address,
724
808
  });
725
809
  });
@@ -731,7 +815,7 @@ let DataServiceImpl = (() => {
731
815
  previousType: evt.previousDescription.type,
732
816
  newType: evt.newDescription.type,
733
817
  };
734
- log.info(mongoLogId(1001000021), this._logCtx(), 'Topology description changed', attr);
818
+ this._logger.info((0, logger_1.mongoLogId)(1001000021), 'Topology description changed', attr);
735
819
  this._lastSeenTopology = evt.newDescription;
736
820
  this._emitter.emit('topologyDescriptionChanged', evt);
737
821
  });
@@ -750,15 +834,9 @@ let DataServiceImpl = (() => {
750
834
  failure: null,
751
835
  duration: evt.duration,
752
836
  });
753
- log.write({
754
- s: 'D2',
755
- id: mongoLogId(1001000022),
756
- ctx: this._logCtx(),
757
- msg: 'Server heartbeat succeeded',
758
- attr: {
759
- connectionId: evt.connectionId,
760
- duration: evt.duration,
761
- },
837
+ this._logger.debug((0, logger_1.mongoLogId)(1001000022), 'Server heartbeat succeeded', {
838
+ connectionId: evt.connectionId,
839
+ duration: evt.duration,
762
840
  });
763
841
  }
764
842
  });
@@ -771,7 +849,7 @@ let DataServiceImpl = (() => {
771
849
  failure: evt.failure.message,
772
850
  duration: evt.duration,
773
851
  });
774
- log.warn(mongoLogId(1001000023), this._logCtx(), 'Server heartbeat failed', {
852
+ this._logger.warn((0, logger_1.mongoLogId)(1001000023), 'Server heartbeat failed', {
775
853
  connectionId: evt.connectionId,
776
854
  duration: evt.duration,
777
855
  failure: evt.failure.message,
@@ -780,33 +858,21 @@ let DataServiceImpl = (() => {
780
858
  });
781
859
  client.on('commandSucceeded', (evt) => {
782
860
  const { address, connectionId, duration, commandName } = evt;
783
- log.write({
784
- s: 'D2',
785
- id: mongoLogId(1001000029),
786
- ctx: this._logCtx(),
787
- msg: 'Driver command succeeded',
788
- attr: {
789
- address,
790
- serverConnectionId: connectionId,
791
- duration,
792
- commandName,
793
- },
861
+ this._logger.debug((0, logger_1.mongoLogId)(1001000029), 'Driver command succeeded', {
862
+ address,
863
+ serverConnectionId: connectionId,
864
+ duration,
865
+ commandName,
794
866
  });
795
867
  });
796
868
  client.on('commandFailed', (evt) => {
797
869
  const { address, connectionId, duration, commandName, failure } = evt;
798
- log.write({
799
- s: 'D1',
800
- id: mongoLogId(1001000030),
801
- ctx: this._logCtx(),
802
- msg: 'Driver command failed',
803
- attr: {
804
- address,
805
- serverConnectionId: connectionId,
806
- duration,
807
- commandName,
808
- failure: failure.message,
809
- },
870
+ this._logger.debug((0, logger_1.mongoLogId)(1001000030), 'Driver command failed', {
871
+ address,
872
+ serverConnectionId: connectionId,
873
+ duration,
874
+ commandName,
875
+ failure: failure.message,
810
876
  });
811
877
  });
812
878
  }
@@ -848,9 +914,6 @@ let DataServiceImpl = (() => {
848
914
  name: collectionName,
849
915
  database: databaseName,
850
916
  is_capped: data.capped,
851
- max: data.max,
852
- is_power_of_two: data.userFlags === 1,
853
- index_sizes: data.indexSizes,
854
917
  document_count: (_a = data.count) !== null && _a !== void 0 ? _a : 0,
855
918
  document_size: data.size,
856
919
  avg_document_size: (_b = data.avgObjSize) !== null && _b !== void 0 ? _b : 0,
@@ -858,14 +921,6 @@ let DataServiceImpl = (() => {
858
921
  free_storage_size: (_d = data.freeStorageSize) !== null && _d !== void 0 ? _d : 0,
859
922
  index_count: (_e = data.nindexes) !== null && _e !== void 0 ? _e : 0,
860
923
  index_size: (_f = data.totalIndexSize) !== null && _f !== void 0 ? _f : 0,
861
- padding_factor: data.paddingFactor,
862
- extent_count: data.numExtents,
863
- extent_last_size: data.lastExtentSize,
864
- flags_user: data.userFlags,
865
- max_document_size: data.maxSize,
866
- size: data.size,
867
- index_details: data.indexDetails || {},
868
- wired_tiger: data.wiredTiger || {},
869
924
  };
870
925
  }
871
926
  _collection(ns, type) {
@@ -893,6 +948,7 @@ let DataServiceImpl = (() => {
893
948
  this._metadataClient = undefined;
894
949
  this._crudClient = undefined;
895
950
  this._tunnel = undefined;
951
+ this._state = undefined;
896
952
  this._mongoClientConnectionOptions = undefined;
897
953
  this._isWritable = false;
898
954
  this._isConnecting = false;
@@ -960,13 +1016,13 @@ let DataServiceImpl = (() => {
960
1016
  }
961
1017
  },
962
1018
  (() => {
963
- _collectionStats_decorators = [op(mongoLogId(1001000178), ([dbName, collName], result) => {
1019
+ _collectionStats_decorators = [op((0, logger_1.mongoLogId)(1001000178), ([dbName, collName], result) => {
964
1020
  return { ns: `${dbName}.${collName}`, ...(result && { result }) };
965
1021
  })];
966
- _collectionInfo_decorators = [op(mongoLogId(1001000179))];
967
- _killOp_decorators = [op(mongoLogId(1001000031))];
968
- __connectionStatus_decorators = [op(mongoLogId(1001000100))];
969
- _listCollections_decorators = [op(mongoLogId(1001000032), ([databaseName, , options], colls) => {
1022
+ _collectionInfo_decorators = [op((0, logger_1.mongoLogId)(1001000179))];
1023
+ _killOp_decorators = [op((0, logger_1.mongoLogId)(1001000031))];
1024
+ __connectionStatus_decorators = [op((0, logger_1.mongoLogId)(1001000100))];
1025
+ _listCollections_decorators = [op((0, logger_1.mongoLogId)(1001000032), ([databaseName, , options], colls) => {
970
1026
  var _a;
971
1027
  return {
972
1028
  db: databaseName,
@@ -974,62 +1030,64 @@ let DataServiceImpl = (() => {
974
1030
  ...(colls && { collectionsCount: colls.length }),
975
1031
  };
976
1032
  })];
977
- _listDatabases_decorators = [op(mongoLogId(1001000033), ([options], dbs) => {
1033
+ _listDatabases_decorators = [op((0, logger_1.mongoLogId)(1001000033), ([options], dbs) => {
978
1034
  var _a;
979
1035
  return {
980
1036
  nameOnly: (_a = options === null || options === void 0 ? void 0 : options.nameOnly) !== null && _a !== void 0 ? _a : false,
981
1037
  ...(dbs && { databasesCount: dbs.length }),
982
1038
  };
983
1039
  })];
984
- _estimatedCount_decorators = [op(mongoLogId(1001000034))];
985
- _count_decorators = [op(mongoLogId(1001000035))];
986
- _createCollection_decorators = [op(mongoLogId(1001000036), ([ns, options], result) => {
1040
+ _estimatedCount_decorators = [op((0, logger_1.mongoLogId)(1001000034))];
1041
+ _count_decorators = [op((0, logger_1.mongoLogId)(1001000035))];
1042
+ _createCollection_decorators = [op((0, logger_1.mongoLogId)(1001000036), ([ns, options], result) => {
987
1043
  return { ns, options, ...(result && { result }) };
988
1044
  })];
989
- _createIndex_decorators = [op(mongoLogId(1001000037), ([ns, spec, options], result) => {
1045
+ _createIndex_decorators = [op((0, logger_1.mongoLogId)(1001000037), ([ns, spec, options], result) => {
990
1046
  return { ns, spec, options, ...(result && { result }) };
991
1047
  })];
992
- _deleteOne_decorators = [op(mongoLogId(1001000038), ([ns], result) => {
1048
+ _deleteOne_decorators = [op((0, logger_1.mongoLogId)(1001000038), ([ns], result) => {
993
1049
  return { ns, ...(result && { result }) };
994
1050
  })];
995
- _deleteMany_decorators = [op(mongoLogId(1001000039), ([ns], result) => {
1051
+ _deleteMany_decorators = [op((0, logger_1.mongoLogId)(1001000039), ([ns], result) => {
996
1052
  return { ns, ...(result && { result }) };
997
1053
  })];
998
- _dropCollection_decorators = [op(mongoLogId(1001000059), ([ns], result) => {
1054
+ _dropCollection_decorators = [op((0, logger_1.mongoLogId)(1001000059), ([ns], result) => {
999
1055
  return { ns, ...(result && { result }) };
1000
1056
  })];
1001
- _dropDatabase_decorators = [op(mongoLogId(1001000040), ([db], result) => {
1057
+ _dropDatabase_decorators = [op((0, logger_1.mongoLogId)(1001000040), ([db], result) => {
1002
1058
  return { db, ...(result && { result }) };
1003
1059
  })];
1004
- _dropIndex_decorators = [op(mongoLogId(1001000182), ([ns, name], result) => {
1060
+ _dropIndex_decorators = [op((0, logger_1.mongoLogId)(1001000182), ([ns, name], result) => {
1005
1061
  return { ns, name, ...(result && { result }) };
1006
1062
  })];
1007
- _aggregateCursor_decorators = [op(mongoLogId(1001000041), ([ns, pipeline]) => {
1063
+ _aggregateCursor_decorators = [op((0, logger_1.mongoLogId)(1001000041), ([ns, pipeline]) => {
1008
1064
  return { ns, stages: pipeline.map((stage) => Object.keys(stage)[0]) };
1009
1065
  })];
1010
- _aggregate_decorators = [op(mongoLogId(1001000181), ([ns, pipeline]) => {
1066
+ _aggregate_decorators = [op((0, logger_1.mongoLogId)(1001000181), ([ns, pipeline]) => {
1011
1067
  return { ns, stages: pipeline.map((stage) => Object.keys(stage)[0]) };
1012
1068
  })];
1013
- _find_decorators = [op(mongoLogId(1001000060))];
1014
- _findCursor_decorators = [op(mongoLogId(1001000043))];
1015
- _findOneAndReplace_decorators = [op(mongoLogId(1001000044))];
1016
- _findOneAndUpdate_decorators = [op(mongoLogId(1001000045))];
1017
- _explainFind_decorators = [op(mongoLogId(1001000046), ([ns, , , executionOptions]) => {
1069
+ _find_decorators = [op((0, logger_1.mongoLogId)(1001000060))];
1070
+ _findCursor_decorators = [op((0, logger_1.mongoLogId)(1001000043))];
1071
+ _findOneAndReplace_decorators = [op((0, logger_1.mongoLogId)(1001000044))];
1072
+ _findOneAndUpdate_decorators = [op((0, logger_1.mongoLogId)(1001000045))];
1073
+ _updateOne_decorators = [op((0, logger_1.mongoLogId)(1001000183))];
1074
+ _replaceOne_decorators = [op((0, logger_1.mongoLogId)(1001000191))];
1075
+ _explainFind_decorators = [op((0, logger_1.mongoLogId)(1001000046), ([ns, , , executionOptions]) => {
1018
1076
  return {
1019
1077
  ns,
1020
1078
  verbosity: (executionOptions === null || executionOptions === void 0 ? void 0 : executionOptions.explainVerbosity) ||
1021
1079
  mongodb.ExplainVerbosity.allPlansExecution,
1022
1080
  };
1023
1081
  })];
1024
- _explainAggregate_decorators = [op(mongoLogId(1001000177), ([ns, , , executionOptions]) => {
1082
+ _explainAggregate_decorators = [op((0, logger_1.mongoLogId)(1001000177), ([ns, , , executionOptions]) => {
1025
1083
  return {
1026
1084
  ns,
1027
1085
  verbosity: (executionOptions === null || executionOptions === void 0 ? void 0 : executionOptions.explainVerbosity) ||
1028
1086
  mongodb.ExplainVerbosity.allPlansExecution,
1029
1087
  };
1030
1088
  })];
1031
- _indexes_decorators = [op(mongoLogId(1001000047))];
1032
- _instance_decorators = [op(mongoLogId(1001000024), (_, instanceData) => {
1089
+ _indexes_decorators = [op((0, logger_1.mongoLogId)(1001000047))];
1090
+ _instance_decorators = [op((0, logger_1.mongoLogId)(1001000024), (_, instanceData) => {
1033
1091
  if (instanceData) {
1034
1092
  return {
1035
1093
  serverVersion: instanceData.build.version,
@@ -1039,10 +1097,10 @@ let DataServiceImpl = (() => {
1039
1097
  };
1040
1098
  }
1041
1099
  })];
1042
- _insertOne_decorators = [op(mongoLogId(1001000048), ([ns], result) => {
1100
+ _insertOne_decorators = [op((0, logger_1.mongoLogId)(1001000048), ([ns], result) => {
1043
1101
  return { ns, ...(result && { acknowledged: result.acknowledged }) };
1044
1102
  })];
1045
- _insertMany_decorators = [op(mongoLogId(1001000049), ([ns], result) => {
1103
+ _insertMany_decorators = [op((0, logger_1.mongoLogId)(1001000049), ([ns], result) => {
1046
1104
  return {
1047
1105
  ns,
1048
1106
  ...(result && {
@@ -1051,19 +1109,19 @@ let DataServiceImpl = (() => {
1051
1109
  }),
1052
1110
  };
1053
1111
  })];
1054
- _updateCollection_decorators = [op(mongoLogId(1001000050), ([ns], result) => {
1112
+ _updateCollection_decorators = [op((0, logger_1.mongoLogId)(1001000050), ([ns], result) => {
1055
1113
  return { ns, ...(result && { result }) };
1056
1114
  })];
1057
- _currentOp_decorators = [op(mongoLogId(1001000053), (_, result) => {
1115
+ _currentOp_decorators = [op((0, logger_1.mongoLogId)(1001000053), (_, result) => {
1058
1116
  return result ? { result } : undefined;
1059
1117
  })];
1060
- _serverStatus_decorators = [op(mongoLogId(1001000061), (_, result) => {
1118
+ _serverStatus_decorators = [op((0, logger_1.mongoLogId)(1001000061), (_, result) => {
1061
1119
  return result ? { result } : undefined;
1062
1120
  })];
1063
- _top_decorators = [op(mongoLogId(1001000062), (_, result) => {
1121
+ _top_decorators = [op((0, logger_1.mongoLogId)(1001000062), (_, result) => {
1064
1122
  return result ? { result } : undefined;
1065
1123
  })];
1066
- _createView_decorators = [op(mongoLogId(1001000055), ([name, sourceNs, pipeline, options], result) => {
1124
+ _createView_decorators = [op((0, logger_1.mongoLogId)(1001000055), ([name, sourceNs, pipeline, options], result) => {
1067
1125
  return {
1068
1126
  name,
1069
1127
  sourceNs,
@@ -1072,8 +1130,8 @@ let DataServiceImpl = (() => {
1072
1130
  ...(result && { result }),
1073
1131
  };
1074
1132
  })];
1075
- _databaseStats_decorators = [op(mongoLogId(1001000057))];
1076
- _createDataKey_decorators = [op(mongoLogId(1001000123), ([provider]) => {
1133
+ _databaseStats_decorators = [op((0, logger_1.mongoLogId)(1001000057))];
1134
+ _createDataKey_decorators = [op((0, logger_1.mongoLogId)(1001000123), ([provider]) => {
1077
1135
  return { provider };
1078
1136
  })];
1079
1137
  __esDecorate(_a, null, _collectionStats_decorators, { kind: "method", name: "collectionStats", static: false, private: false, access: { has: obj => "collectionStats" in obj, get: obj => obj.collectionStats } }, null, _instanceExtraInitializers);
@@ -1097,6 +1155,8 @@ let DataServiceImpl = (() => {
1097
1155
  __esDecorate(_a, null, _findCursor_decorators, { kind: "method", name: "findCursor", static: false, private: false, access: { has: obj => "findCursor" in obj, get: obj => obj.findCursor } }, null, _instanceExtraInitializers);
1098
1156
  __esDecorate(_a, null, _findOneAndReplace_decorators, { kind: "method", name: "findOneAndReplace", static: false, private: false, access: { has: obj => "findOneAndReplace" in obj, get: obj => obj.findOneAndReplace } }, null, _instanceExtraInitializers);
1099
1157
  __esDecorate(_a, null, _findOneAndUpdate_decorators, { kind: "method", name: "findOneAndUpdate", static: false, private: false, access: { has: obj => "findOneAndUpdate" in obj, get: obj => obj.findOneAndUpdate } }, null, _instanceExtraInitializers);
1158
+ __esDecorate(_a, null, _updateOne_decorators, { kind: "method", name: "updateOne", static: false, private: false, access: { has: obj => "updateOne" in obj, get: obj => obj.updateOne } }, null, _instanceExtraInitializers);
1159
+ __esDecorate(_a, null, _replaceOne_decorators, { kind: "method", name: "replaceOne", static: false, private: false, access: { has: obj => "replaceOne" in obj, get: obj => obj.replaceOne } }, null, _instanceExtraInitializers);
1100
1160
  __esDecorate(_a, null, _explainFind_decorators, { kind: "method", name: "explainFind", static: false, private: false, access: { has: obj => "explainFind" in obj, get: obj => obj.explainFind } }, null, _instanceExtraInitializers);
1101
1161
  __esDecorate(_a, null, _explainAggregate_decorators, { kind: "method", name: "explainAggregate", static: false, private: false, access: { has: obj => "explainAggregate" in obj, get: obj => obj.explainAggregate } }, null, _instanceExtraInitializers);
1102
1162
  __esDecorate(_a, null, _indexes_decorators, { kind: "method", name: "indexes", static: false, private: false, access: { has: obj => "indexes" in obj, get: obj => obj.indexes } }, null, _instanceExtraInitializers);