@resolveio/server-lib 9.8.12 → 9.9.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.
@@ -15,7 +15,6 @@ interface MongoQueueModel {
15
15
  running: boolean;
16
16
  cacheId: number;
17
17
  next_run?: Date;
18
- last_run?: Date;
19
18
  }
20
19
  export declare class MongoManager {
21
20
  private _collections;
@@ -51,7 +50,7 @@ export declare class Collection<T> {
51
50
  createLogs: boolean;
52
51
  useRB: boolean;
53
52
  constructor(collectionName: string, schema: object, useReportBuilder: any, reportBuilderLookupTables: LookupTables[], timestamps: any, createLogs: any, checkSchema: any);
54
- aggregate(pipeline: object[], options?: AggregateOptions, allowLogs?: boolean): Promise<any[]>;
53
+ aggregate(pipeline: object[], options?: AggregateOptions, skipCache?: boolean): Promise<any[]>;
55
54
  aggregateCount(pipeline: object[], options?: AggregateOptions): Promise<number>;
56
55
  aggregateCursor(pipeline: object[], options?: AggregateOptions): import("mongodb").AggregationCursor<import("bson").Document>;
57
56
  aggregateStream(pipeline: object[], options?: AggregateOptions): import("stream").Readable;
@@ -65,12 +64,12 @@ export declare class Collection<T> {
65
64
  drop(options?: CommandOperationOptions): Promise<boolean>;
66
65
  dropIndex(indexName: string, options?: CommandOperationOptions): Promise<import("bson").Document>;
67
66
  dropIndexes(options?: CommandOperationOptions): Promise<import("bson").Document>;
68
- find(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<T[]>;
67
+ find(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T[]>;
69
68
  findById(id: string, options?: FindOptions<T>): Promise<T>;
70
69
  findCount(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<Number>;
71
70
  findCursor(filter?: Filter<T>, options?: FindOptions<T>): import("mongodb").FindCursor<import("bson").Document>;
72
71
  findStream(filter?: Filter<T>, options?: FindOptions<T>, streamOptions?: CursorStreamOptions): import("stream").Readable;
73
- findOne(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<T>;
72
+ findOne(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T>;
74
73
  findOneAndDelete(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<T>;
75
74
  findOneAndReplace(filter: Filter<T>, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
76
75
  findOneAndUpdate(filter: Filter<T>, update: any, options?: FindOneAndUpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
@@ -92,12 +92,11 @@ var MongoManager = /** @class */ (function () {
92
92
  else {
93
93
  _mongoQueue.cbs_next.push(mongoQueue.cbs[0]);
94
94
  }
95
- _mongoQueue.next_run = _mongoQueue.last_run ? moment(_mongoQueue.last_run).add(1, 'second').toDate() : null;
96
95
  }
97
96
  else {
98
97
  mongoQueue._id = this._mongoQueueId;
99
98
  this._mongoQueueId += 1;
100
- this._mongoQueue.push(mongoQueue);
99
+ this._mongoQueue.splice(0, 0, mongoQueue);
101
100
  }
102
101
  };
103
102
  MongoManager.prototype.runQueue = function () {
@@ -122,9 +121,9 @@ var MongoManager = /** @class */ (function () {
122
121
  mongoQueue.running = false;
123
122
  }
124
123
  else {
125
- mongoQueue.last_run = new Date();
126
124
  if (!mongoQueue.name_function_addt) {
127
125
  (_a = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_a, mongoQueue.data_function).then(function (res) {
126
+ mongoQueue.next_run = moment().add(1, 'second').toDate();
128
127
  mongoQueue.cacheId = _this._mongoQueueCacheId;
129
128
  _this._mongoQueueCacheId += 1;
130
129
  _this.addToCache(mongoQueue.cacheId, res);
@@ -146,11 +145,14 @@ var MongoManager = /** @class */ (function () {
146
145
  mongoQueue.cbs_next.forEach(function (cb) {
147
146
  cb(err, null, false);
148
147
  });
149
- _this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
148
+ if (_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id) >= 0) {
149
+ _this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
150
+ }
150
151
  });
151
152
  }
152
153
  else {
153
154
  (_b = (_c = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_c, mongoQueue.data_function))[mongoQueue.name_function_addt].apply(_b, mongoQueue.data_function_addt).then(function (res) {
155
+ mongoQueue.next_run = moment().add(1, 'second').toDate();
154
156
  mongoQueue.cacheId = _this._mongoQueueCacheId;
155
157
  _this._mongoQueueCacheId += 1;
156
158
  _this.addToCache(mongoQueue.cacheId, res);
@@ -172,7 +174,9 @@ var MongoManager = /** @class */ (function () {
172
174
  mongoQueue.cbs_next.forEach(function (cb) {
173
175
  cb(err, null, false);
174
176
  });
175
- _this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
177
+ if (_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id) >= 0) {
178
+ _this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
179
+ }
176
180
  });
177
181
  }
178
182
  }
@@ -193,9 +197,12 @@ var MongoManager = /** @class */ (function () {
193
197
  if (nodeCacheSize > this._heapLimit) {
194
198
  var deleteCount = 0;
195
199
  var queueArr = this._mongoQueue.filter(function (a) { return a.cacheId; });
196
- for (var zz = 0; zz < queueArr.length; zz++) {
200
+ for (var zz = queueArr.length - 1; zz >= 0; zz--) {
197
201
  this._nodeCache.del(queueArr[zz].cacheId);
198
202
  queueArr[zz].cacheId = 0;
203
+ if (this._mongoQueue.map(function (a) { return a._id; }).indexOf(queueArr[zz]._id) >= 0) {
204
+ this._mongoQueue.splice(this._mongoQueue.map(function (a) { return a._id; }).indexOf(queueArr[zz]._id), 1);
205
+ }
199
206
  deleteCount += 1;
200
207
  nodeCacheSize = this._nodeCache.getStats().vsize;
201
208
  if (nodeCacheSize < this._heapLimit * 0.75) {
@@ -207,11 +214,15 @@ var MongoManager = /** @class */ (function () {
207
214
  this._nodeCache.set(id, JSON.stringify(data));
208
215
  };
209
216
  MongoManager.prototype.invalidateQueryCache = function (collection) {
210
- var _this = this;
211
- this._mongoQueue.filter(function (a) { return (a.name_collection === collection || a.lookup_collections.includes(collection)) && a.cacheId; }).forEach(function (queue) {
212
- _this._nodeCache.del(queue.cacheId);
217
+ var queueArr = this._mongoQueue.filter(function (a) { return (a.name_collection === collection || a.lookup_collections.includes(collection)); });
218
+ for (var i = queueArr.length - 1; i >= 0; i--) {
219
+ var queue = queueArr[i];
220
+ this._nodeCache.del(queue.cacheId);
213
221
  queue.cacheId = 0;
214
- });
222
+ if (this._mongoQueue.map(function (a) { return a._id; }).indexOf(queue._id) >= 0) {
223
+ this._mongoQueue.splice(this._mongoQueue.map(function (a) { return a._id; }).indexOf(queue._id), 1);
224
+ }
225
+ }
215
226
  };
216
227
  return MongoManager;
217
228
  }());
@@ -280,23 +291,11 @@ var Collection = /** @class */ (function () {
280
291
  }
281
292
  }, 1);
282
293
  }
283
- Collection.prototype.aggregate = function (pipeline, options, allowLogs) {
294
+ Collection.prototype.aggregate = function (pipeline, options, skipCache) {
284
295
  var _this = this;
285
- if (allowLogs === void 0) { allowLogs = false; }
296
+ if (skipCache === void 0) { skipCache = false; }
286
297
  return new Promise(function (resolve, reject) {
287
- if (_this.createLogs && allowLogs) {
288
- // Logs.insertOne({
289
- // _id: objectIdHexString(),
290
- // type: 'query',
291
- // collection: this.collectionName,
292
- // id_document: '',
293
- // payload: JSON.stringify([pipeline, options], null, 2),
294
- // method: 'aggregate',
295
- // id_user: '',
296
- // user: '',
297
- // messageId: 0,
298
- // route: ''
299
- // });
298
+ if (!skipCache) {
300
299
  index_1.ResolveIOServer.getMongoManager().addToQueue({
301
300
  _id: 0,
302
301
  name_collection: _this.collectionName,
@@ -305,20 +304,6 @@ var Collection = /** @class */ (function () {
305
304
  data_function: [pipeline, options],
306
305
  data_function_addt: [],
307
306
  cbs: [function (err, res, cached) {
308
- if (_this.createLogs && allowLogs) {
309
- // Logs.insertOne({
310
- // _id: objectIdHexString(),
311
- // type: 'queryResponse',
312
- // collection: this.collectionName,
313
- // id_document: '',
314
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
315
- // method: 'aggregate',
316
- // id_user: '',
317
- // user: '',
318
- // messageId: 0,
319
- // route: ''
320
- // });
321
- }
322
307
  if (err) {
323
308
  reject(err);
324
309
  }
@@ -440,7 +425,7 @@ var Collection = /** @class */ (function () {
440
425
  case 2:
441
426
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteMany(filter, options).then(function (res) {
442
427
  if (res.acknowledged) {
443
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete', false);
428
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
444
429
  resolve(res.deletedCount);
445
430
  }
446
431
  else {
@@ -485,7 +470,7 @@ var Collection = /** @class */ (function () {
485
470
  index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
486
471
  index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany({ $and: [{ '_id._id': doc['_id'] }, { '_id.__v': { $lt: doc['__v'] - 1 } }] });
487
472
  }
488
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(this.collectionName, 'delete', false);
473
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);
489
474
  resolve(1);
490
475
  }
491
476
  else {
@@ -498,7 +483,7 @@ var Collection = /** @class */ (function () {
498
483
  else {
499
484
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteOne(filter, options).then(function (res) {
500
485
  if (res.acknowledged) {
501
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete', false);
486
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
502
487
  resolve(res.deletedCount);
503
488
  }
504
489
  else {
@@ -522,26 +507,13 @@ var Collection = /** @class */ (function () {
522
507
  Collection.prototype.dropIndexes = function (options) {
523
508
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).dropIndexes(options);
524
509
  };
525
- Collection.prototype.find = function (filter, options, bypassLogs) {
510
+ Collection.prototype.find = function (filter, options, skipCache) {
526
511
  var _this = this;
527
512
  if (filter === void 0) { filter = {}; }
528
- if (bypassLogs === void 0) { bypassLogs = false; }
513
+ if (skipCache === void 0) { skipCache = false; }
529
514
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
530
- var _this = this;
531
515
  return __generator(this, function (_a) {
532
- if (this.createLogs && !bypassLogs) {
533
- // Logs.insertOne({
534
- // _id: objectIdHexString(),
535
- // type: 'query',
536
- // collection: this.collectionName,
537
- // id_document: '',
538
- // payload: JSON.stringify([filter, options], null, 2),
539
- // method: 'find',
540
- // id_user: '',
541
- // user: '',
542
- // messageId: 0,
543
- // route: ''
544
- // });
516
+ if (!skipCache) {
545
517
  index_1.ResolveIOServer.getMongoManager().addToQueue({
546
518
  _id: 0,
547
519
  name_collection: this.collectionName,
@@ -550,20 +522,6 @@ var Collection = /** @class */ (function () {
550
522
  data_function: [filter, options],
551
523
  data_function_addt: [],
552
524
  cbs: [function (err, res, cached) {
553
- if (_this.createLogs && !bypassLogs) {
554
- // Logs.insertOne({
555
- // _id: objectIdHexString(),
556
- // type: 'queryResponse',
557
- // collection: this.collectionName,
558
- // id_document: '',
559
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
560
- // method: 'find',
561
- // id_user: '',
562
- // user: '',
563
- // messageId: 0,
564
- // route: ''
565
- // });
566
- }
567
525
  if (err) {
568
526
  reject(err);
569
527
  }
@@ -593,20 +551,6 @@ var Collection = /** @class */ (function () {
593
551
  Collection.prototype.findCount = function (filter, options, bypassLogs) {
594
552
  if (filter === void 0) { filter = {}; }
595
553
  if (bypassLogs === void 0) { bypassLogs = false; }
596
- if (this.createLogs && !bypassLogs) {
597
- // Logs.insertOne({
598
- // _id: objectIdHexString(),
599
- // type: 'query',
600
- // collection: this.collectionName,
601
- // id_document: '',
602
- // payload: JSON.stringify([filter, options], null, 2),
603
- // method: 'findCount',
604
- // id_user: '',
605
- // user: '',
606
- // messageId: 0,
607
- // route: ''
608
- // });
609
- }
610
554
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).count();
611
555
  };
612
556
  Collection.prototype.findCursor = function (filter, options) {
@@ -617,24 +561,12 @@ var Collection = /** @class */ (function () {
617
561
  if (filter === void 0) { filter = {}; }
618
562
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).stream(streamOptions);
619
563
  };
620
- Collection.prototype.findOne = function (filter, options, bypassLogs) {
564
+ Collection.prototype.findOne = function (filter, options, skipCache) {
621
565
  var _this = this;
622
566
  if (filter === void 0) { filter = {}; }
623
- if (bypassLogs === void 0) { bypassLogs = false; }
567
+ if (skipCache === void 0) { skipCache = false; }
624
568
  return new Promise(function (resolve, reject) {
625
- if (_this.createLogs && !bypassLogs) {
626
- // Logs.insertOne({
627
- // _id: objectIdHexString(),
628
- // type: 'query',
629
- // collection: this.collectionName,
630
- // id_document: '',
631
- // payload: JSON.stringify([filter, options], null, 2),
632
- // method: 'findOne',
633
- // id_user: '',
634
- // user: '',
635
- // messageId: 0,
636
- // route: ''
637
- // });
569
+ if (!skipCache) {
638
570
  index_1.ResolveIOServer.getMongoManager().addToQueue({
639
571
  _id: 0,
640
572
  name_collection: _this.collectionName,
@@ -649,20 +581,6 @@ var Collection = /** @class */ (function () {
649
581
  else {
650
582
  resolve(res);
651
583
  }
652
- if (_this.createLogs && !bypassLogs) {
653
- // Logs.insertOne({
654
- // _id: objectIdHexString(),
655
- // type: 'queryResponse',
656
- // collection: this.collectionName,
657
- // id_document: '',
658
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
659
- // method: 'findOne',
660
- // id_user: '',
661
- // user: '',
662
- // messageId: 0,
663
- // route: ''
664
- // });
665
- }
666
584
  }],
667
585
  cbs_next: [],
668
586
  running: false,
@@ -704,7 +622,7 @@ var Collection = /** @class */ (function () {
704
622
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
705
623
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
706
624
  }
707
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete', false);
625
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
708
626
  resolve(doc);
709
627
  }
710
628
  else {
@@ -771,7 +689,7 @@ var Collection = /** @class */ (function () {
771
689
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
772
690
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
773
691
  }
774
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
692
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
775
693
  resolve(doc);
776
694
  }
777
695
  else {
@@ -855,7 +773,7 @@ var Collection = /** @class */ (function () {
855
773
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
856
774
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
857
775
  }
858
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
776
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
859
777
  resolve(doc);
860
778
  }
861
779
  else {
@@ -930,7 +848,7 @@ var Collection = /** @class */ (function () {
930
848
  if (validDocs.length) {
931
849
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertMany(validDocs, options).then(function (res) {
932
850
  if (res.acknowledged) {
933
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert', false);
851
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
934
852
  resolve(validDocs);
935
853
  }
936
854
  else {
@@ -989,7 +907,7 @@ var Collection = /** @class */ (function () {
989
907
  }
990
908
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertOne(doc, options).then(function (res) {
991
909
  if (res.acknowledged) {
992
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert', false);
910
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
993
911
  resolve(doc);
994
912
  }
995
913
  else {
@@ -1068,7 +986,7 @@ var Collection = /** @class */ (function () {
1068
986
  }
1069
987
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1070
988
  if (res.acknowledged) {
1071
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
989
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1072
990
  resolve(res.modifiedCount);
1073
991
  }
1074
992
  else {
@@ -1110,7 +1028,7 @@ var Collection = /** @class */ (function () {
1110
1028
  }
1111
1029
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, updatedDoc, options).then(function (res) {
1112
1030
  if (res.acknowledged) {
1113
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1031
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1114
1032
  resolve(res.modifiedCount);
1115
1033
  }
1116
1034
  else {
@@ -1150,7 +1068,7 @@ var Collection = /** @class */ (function () {
1150
1068
  }
1151
1069
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1152
1070
  if (res.acknowledged) {
1153
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1071
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1154
1072
  resolve(res.modifiedCount);
1155
1073
  }
1156
1074
  else {
@@ -1212,14 +1130,14 @@ var Collection = /** @class */ (function () {
1212
1130
  route: ''
1213
1131
  });
1214
1132
  }
1215
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1133
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1216
1134
  resolve(res.ok);
1217
1135
  }, function (err) { return reject(err); });
1218
1136
  }
1219
1137
  else {
1220
1138
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1221
1139
  if (res.acknowledged) {
1222
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1140
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1223
1141
  resolve(res.modifiedCount);
1224
1142
  }
1225
1143
  else {
@@ -1309,7 +1227,7 @@ var Collection = /** @class */ (function () {
1309
1227
  case 2:
1310
1228
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateMany(filter, update, options).then(function (res) {
1311
1229
  if (res.acknowledged) {
1312
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1230
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1313
1231
  resolve(res.modifiedCount);
1314
1232
  }
1315
1233
  else {
@@ -1385,7 +1303,7 @@ var Collection = /** @class */ (function () {
1385
1303
  }
1386
1304
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1387
1305
  if (res.acknowledged) {
1388
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1306
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1389
1307
  resolve(res.modifiedCount);
1390
1308
  }
1391
1309
  else {
@@ -1433,7 +1351,7 @@ var Collection = /** @class */ (function () {
1433
1351
  }
1434
1352
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1435
1353
  if (res.acknowledged) {
1436
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1354
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1437
1355
  resolve(res.modifiedCount);
1438
1356
  }
1439
1357
  else {
@@ -1506,7 +1424,7 @@ var Collection = /** @class */ (function () {
1506
1424
  messageId: 0,
1507
1425
  route: ''
1508
1426
  });
1509
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1427
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1510
1428
  resolve(res.ok);
1511
1429
  }
1512
1430
  else {
@@ -1517,7 +1435,7 @@ var Collection = /** @class */ (function () {
1517
1435
  else {
1518
1436
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1519
1437
  if (res.acknowledged) {
1520
- index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update', false);
1438
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1521
1439
  resolve(res.modifiedCount);
1522
1440
  }
1523
1441
  else {