@resolveio/server-lib 12.5.10 → 12.5.12
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.
|
@@ -191,6 +191,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
191
191
|
(_a = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_a, mongoQueue.data_function).then(function (res) {
|
|
192
192
|
monitor_1.finish();
|
|
193
193
|
if (!mongoQueue.invalidateFlag) {
|
|
194
|
+
mongoQueue.invalidateCount = 0;
|
|
194
195
|
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
195
196
|
_this._mongoQueueCacheId += 1;
|
|
196
197
|
_this.addToCache(mongoQueue.cacheId, res);
|
|
@@ -206,6 +207,12 @@ var MongoManager = /** @class */ (function () {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
else {
|
|
210
|
+
if (mongoQueue.invalidateCount >= 5) {
|
|
211
|
+
mongoQueue.invalidateCount = 0;
|
|
212
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
213
|
+
cb(null, res, false);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
209
216
|
mongoQueue.cbs = mongoQueue.cbs.concat(mongoQueue.cbs_next);
|
|
210
217
|
mongoQueue.cbs_next = [];
|
|
211
218
|
}
|
|
@@ -229,6 +236,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
229
236
|
(_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) {
|
|
230
237
|
monitor_2.finish();
|
|
231
238
|
if (!mongoQueue.invalidateFlag) {
|
|
239
|
+
mongoQueue.invalidateCount = 0;
|
|
232
240
|
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
233
241
|
_this._mongoQueueCacheId += 1;
|
|
234
242
|
_this.addToCache(mongoQueue.cacheId, res);
|
|
@@ -244,6 +252,12 @@ var MongoManager = /** @class */ (function () {
|
|
|
244
252
|
}
|
|
245
253
|
}
|
|
246
254
|
else {
|
|
255
|
+
if (mongoQueue.invalidateCount >= 5) {
|
|
256
|
+
mongoQueue.invalidateCount = 0;
|
|
257
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
258
|
+
cb(null, res, false);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
247
261
|
mongoQueue.cbs = mongoQueue.cbs.concat(mongoQueue.cbs_next);
|
|
248
262
|
mongoQueue.cbs_next = [];
|
|
249
263
|
}
|
|
@@ -307,6 +321,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
307
321
|
}
|
|
308
322
|
if (queue.running) {
|
|
309
323
|
queue.invalidateFlag = true;
|
|
324
|
+
queue.invalidateCount += 1;
|
|
310
325
|
}
|
|
311
326
|
else if (!queue.cbs.length) {
|
|
312
327
|
if (this._mongoQueue.map(function (a) { return a._id; }).indexOf(queue._id) >= 0) {
|
|
@@ -392,42 +407,52 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
392
407
|
var _this = this;
|
|
393
408
|
if (skipCache === void 0) { skipCache = false; }
|
|
394
409
|
return new Promise(function (resolve, reject) {
|
|
395
|
-
if (!skipCache) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
410
|
+
// if (!skipCache) {
|
|
411
|
+
// ResolveIOServer.getMongoManager().addToQueue({
|
|
412
|
+
// _id: 0,
|
|
413
|
+
// name_collection: this.collectionName,
|
|
414
|
+
// name_function: 'aggregate',
|
|
415
|
+
// name_function_addt: 'toArray',
|
|
416
|
+
// data_function: [pipeline, options],
|
|
417
|
+
// data_function_addt: [],
|
|
418
|
+
// cbs: [(err, res, cached) => {
|
|
419
|
+
// if (err) {
|
|
420
|
+
// reject(err);
|
|
421
|
+
// }
|
|
422
|
+
// else {
|
|
423
|
+
// resolve(res);
|
|
424
|
+
// }
|
|
425
|
+
// }],
|
|
426
|
+
// cbs_next: [],
|
|
427
|
+
// running: false,
|
|
428
|
+
// cacheId: 0,
|
|
429
|
+
// lookup_collections: pipeline.filter(a => a['$lookup'] && a['$lookup'].from).map(a => a['$lookup'].from).filter((elem, index, self) => {
|
|
430
|
+
// return index === self.indexOf(elem);
|
|
431
|
+
// }),
|
|
432
|
+
// invalidateFlag: false,
|
|
433
|
+
// invalidateCount: 0
|
|
434
|
+
// });
|
|
435
|
+
// }
|
|
436
|
+
// else {
|
|
437
|
+
// let monitor = new MonitorMongo('aggregate', this.collectionName, JSON.stringify([pipeline, options]));
|
|
438
|
+
// ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray().then(res => {
|
|
439
|
+
// monitor.finish();
|
|
440
|
+
// resolve(res);
|
|
441
|
+
// }, err => {
|
|
442
|
+
// monitor.finish();
|
|
443
|
+
// console.log(new Date(), 'Error Aggregate', this.collectionName, pipeline, options, err);
|
|
444
|
+
// reject(err);
|
|
445
|
+
// });
|
|
446
|
+
// }
|
|
447
|
+
var monitor = new monitor_manager_1.MonitorMongo('aggregate', _this.collectionName, JSON.stringify([pipeline, options]));
|
|
448
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).aggregate(pipeline, options).toArray().then(function (res) {
|
|
449
|
+
monitor.finish();
|
|
450
|
+
resolve(res);
|
|
451
|
+
}, function (err) {
|
|
452
|
+
monitor.finish();
|
|
453
|
+
console.log(new Date(), 'Error Aggregate', _this.collectionName, pipeline, options, err);
|
|
454
|
+
reject(err);
|
|
455
|
+
});
|
|
431
456
|
});
|
|
432
457
|
};
|
|
433
458
|
MongoManagerCollection.prototype.aggregateCount = function (pipeline, options) {
|
|
@@ -454,7 +479,8 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
454
479
|
lookup_collections: pipeline.filter(function (a) { return a['$lookup'] && a['$lookup'].from; }).map(function (a) { return a['$lookup'].from; }).filter(function (elem, index, self) {
|
|
455
480
|
return index === self.indexOf(elem);
|
|
456
481
|
}),
|
|
457
|
-
invalidateFlag: false
|
|
482
|
+
invalidateFlag: false,
|
|
483
|
+
invalidateCount: 0
|
|
458
484
|
});
|
|
459
485
|
});
|
|
460
486
|
};
|
|
@@ -502,12 +528,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
502
528
|
var _this = this;
|
|
503
529
|
return new Promise(function (resolve, reject) {
|
|
504
530
|
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
505
|
-
var
|
|
531
|
+
var monitor_3 = new monitor_manager_1.MonitorMongo('createIndex', _this.collectionName, JSON.stringify([fieldOrSpec, options]));
|
|
506
532
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndex(fieldOrSpec, options).then(function (res) {
|
|
507
|
-
|
|
533
|
+
monitor_3.finish();
|
|
508
534
|
resolve(res);
|
|
509
535
|
}, function (err) {
|
|
510
|
-
|
|
536
|
+
monitor_3.finish();
|
|
511
537
|
console.log(new Date(), 'Error Setting Up Index for Collection', _this.collectionName, fieldOrSpec, options, err);
|
|
512
538
|
reject(err);
|
|
513
539
|
});
|
|
@@ -518,12 +544,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
518
544
|
var _this = this;
|
|
519
545
|
return new Promise(function (resolve, reject) {
|
|
520
546
|
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
521
|
-
var
|
|
547
|
+
var monitor_4 = new monitor_manager_1.MonitorMongo('createIndexes', _this.collectionName, JSON.stringify([indexSpecs, options]));
|
|
522
548
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndexes(indexSpecs, options).then(function (res) {
|
|
523
|
-
|
|
549
|
+
monitor_4.finish();
|
|
524
550
|
resolve(res);
|
|
525
551
|
}, function (err) {
|
|
526
|
-
|
|
552
|
+
monitor_4.finish();
|
|
527
553
|
console.log(new Date(), 'Error Setting Up Indexes for Collection', _this.collectionName, indexSpecs, options, err);
|
|
528
554
|
reject(err);
|
|
529
555
|
});
|
|
@@ -592,15 +618,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
592
618
|
if (filter === void 0) { filter = {}; }
|
|
593
619
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
594
620
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
595
|
-
var
|
|
621
|
+
var monitor_5, monitor_6;
|
|
596
622
|
var _this = this;
|
|
597
623
|
return __generator(this, function (_a) {
|
|
598
624
|
if (this.createLogs && !bypassLogs) {
|
|
599
|
-
|
|
625
|
+
monitor_5 = new monitor_manager_1.MonitorMongo('findOneAndDelete', this.collectionName, JSON.stringify([filter, options]));
|
|
600
626
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndDelete(filter, options).then(function (returnVal) { return __awaiter(_this, void 0, void 0, function () {
|
|
601
627
|
var doc, versionDoc;
|
|
602
628
|
return __generator(this, function (_a) {
|
|
603
|
-
|
|
629
|
+
monitor_5.finish();
|
|
604
630
|
doc = returnVal.value;
|
|
605
631
|
if (doc) {
|
|
606
632
|
if (this.createLogs && !bypassLogs) {
|
|
@@ -632,15 +658,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
632
658
|
return [2 /*return*/];
|
|
633
659
|
});
|
|
634
660
|
}); }, function (err) {
|
|
635
|
-
|
|
661
|
+
monitor_5.finish();
|
|
636
662
|
console.log(new Date(), 'Error Find One And Delete', _this.collectionName, filter, options, err);
|
|
637
663
|
reject(err);
|
|
638
664
|
});
|
|
639
665
|
}
|
|
640
666
|
else {
|
|
641
|
-
|
|
667
|
+
monitor_6 = new monitor_manager_1.MonitorMongo('deleteOne', this.collectionName, JSON.stringify([filter, options]));
|
|
642
668
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options).then(function (res) {
|
|
643
|
-
|
|
669
|
+
monitor_6.finish();
|
|
644
670
|
if (res.acknowledged) {
|
|
645
671
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
646
672
|
resolve(res.deletedCount);
|
|
@@ -649,7 +675,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
649
675
|
reject(res.acknowledged);
|
|
650
676
|
}
|
|
651
677
|
}, function (err) {
|
|
652
|
-
|
|
678
|
+
monitor_6.finish();
|
|
653
679
|
console.log(new Date(), 'Error Delete One', _this.collectionName, filter, options, err);
|
|
654
680
|
reject(err);
|
|
655
681
|
});
|
|
@@ -719,7 +745,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
719
745
|
if (filter === void 0) { filter = {}; }
|
|
720
746
|
if (skipCache === void 0) { skipCache = false; }
|
|
721
747
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
722
|
-
var
|
|
748
|
+
var monitor_7;
|
|
723
749
|
var _this = this;
|
|
724
750
|
return __generator(this, function (_a) {
|
|
725
751
|
if (!skipCache) {
|
|
@@ -742,16 +768,17 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
742
768
|
running: false,
|
|
743
769
|
cacheId: 0,
|
|
744
770
|
lookup_collections: [],
|
|
745
|
-
invalidateFlag: false
|
|
771
|
+
invalidateFlag: false,
|
|
772
|
+
invalidateCount: 0
|
|
746
773
|
});
|
|
747
774
|
}
|
|
748
775
|
else {
|
|
749
|
-
|
|
776
|
+
monitor_7 = new monitor_manager_1.MonitorMongo('find', this.collectionName, JSON.stringify([filter, options]));
|
|
750
777
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options).toArray().then(function (res) {
|
|
751
|
-
|
|
778
|
+
monitor_7.finish();
|
|
752
779
|
resolve(res);
|
|
753
780
|
}, function (err) {
|
|
754
|
-
|
|
781
|
+
monitor_7.finish();
|
|
755
782
|
console.log(new Date(), 'Error Find', _this.collectionName, filter, options, err);
|
|
756
783
|
reject(err);
|
|
757
784
|
});
|
|
@@ -834,16 +861,17 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
834
861
|
running: false,
|
|
835
862
|
cacheId: 0,
|
|
836
863
|
lookup_collections: [],
|
|
837
|
-
invalidateFlag: false
|
|
864
|
+
invalidateFlag: false,
|
|
865
|
+
invalidateCount: 0
|
|
838
866
|
});
|
|
839
867
|
}
|
|
840
868
|
else {
|
|
841
|
-
var
|
|
869
|
+
var monitor_8 = new monitor_manager_1.MonitorMongo('findOne', _this.collectionName, JSON.stringify([filter, options]));
|
|
842
870
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).findOne(filter, options).then(function (res) {
|
|
843
|
-
|
|
871
|
+
monitor_8.finish();
|
|
844
872
|
resolve(res);
|
|
845
873
|
}, function (err) {
|
|
846
|
-
|
|
874
|
+
monitor_8.finish();
|
|
847
875
|
console.log(new Date(), 'Error Find One', _this.collectionName, filter, options, err);
|
|
848
876
|
reject(err);
|
|
849
877
|
});
|
|
@@ -1093,7 +1121,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1093
1121
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1094
1122
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1095
1123
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1096
|
-
var validationResults, validDocs, i, doc, date,
|
|
1124
|
+
var validationResults, validDocs, i, doc, date, monitor_9;
|
|
1097
1125
|
var _this = this;
|
|
1098
1126
|
return __generator(this, function (_a) {
|
|
1099
1127
|
if (!docs.length) {
|
|
@@ -1142,9 +1170,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1142
1170
|
}
|
|
1143
1171
|
}
|
|
1144
1172
|
if (validDocs.length) {
|
|
1145
|
-
|
|
1173
|
+
monitor_9 = new monitor_manager_1.MonitorMongo('insertMany', this.collectionName, JSON.stringify([validDocs, options]));
|
|
1146
1174
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options).then(function (res) {
|
|
1147
|
-
|
|
1175
|
+
monitor_9.finish();
|
|
1148
1176
|
if (res.acknowledged) {
|
|
1149
1177
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1150
1178
|
resolve(validDocs);
|
|
@@ -1153,7 +1181,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1153
1181
|
reject(res.acknowledged);
|
|
1154
1182
|
}
|
|
1155
1183
|
}, function (err) {
|
|
1156
|
-
|
|
1184
|
+
monitor_9.finish();
|
|
1157
1185
|
console.log(new Date(), 'Error Insert Many', _this.collectionName, validDocs, options, err);
|
|
1158
1186
|
reject(err);
|
|
1159
1187
|
});
|
|
@@ -1253,7 +1281,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1253
1281
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1254
1282
|
if (doc === void 0) { doc = null; }
|
|
1255
1283
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1256
|
-
var validation, isValid, date, versionDoc,
|
|
1284
|
+
var validation, isValid, date, versionDoc, monitor_10, prevDoc, docId, docVersion, updatedDoc_1, monitor_11, monitor_12, monitor_13, monitor_14;
|
|
1257
1285
|
var _this = this;
|
|
1258
1286
|
return __generator(this, function (_a) {
|
|
1259
1287
|
switch (_a.label) {
|
|
@@ -1305,9 +1333,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1305
1333
|
route: ''
|
|
1306
1334
|
});
|
|
1307
1335
|
}
|
|
1308
|
-
|
|
1336
|
+
monitor_10 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1309
1337
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1310
|
-
|
|
1338
|
+
monitor_10.finish();
|
|
1311
1339
|
if (res.acknowledged) {
|
|
1312
1340
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1313
1341
|
resolve(res.modifiedCount);
|
|
@@ -1316,7 +1344,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1316
1344
|
reject(res.acknowledged);
|
|
1317
1345
|
}
|
|
1318
1346
|
}, function (err) {
|
|
1319
|
-
|
|
1347
|
+
monitor_10.finish();
|
|
1320
1348
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1321
1349
|
reject(err);
|
|
1322
1350
|
});
|
|
@@ -1351,9 +1379,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1351
1379
|
route: ''
|
|
1352
1380
|
});
|
|
1353
1381
|
}
|
|
1354
|
-
|
|
1382
|
+
monitor_11 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc_1, options]));
|
|
1355
1383
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, updatedDoc_1, options).then(function (res) {
|
|
1356
|
-
|
|
1384
|
+
monitor_11.finish();
|
|
1357
1385
|
if (res.acknowledged) {
|
|
1358
1386
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1359
1387
|
resolve(res.modifiedCount);
|
|
@@ -1362,7 +1390,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1362
1390
|
reject(res.acknowledged);
|
|
1363
1391
|
}
|
|
1364
1392
|
}, function (err) {
|
|
1365
|
-
|
|
1393
|
+
monitor_11.finish();
|
|
1366
1394
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, updatedDoc_1, options, err);
|
|
1367
1395
|
reject(err);
|
|
1368
1396
|
});
|
|
@@ -1395,9 +1423,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1395
1423
|
route: ''
|
|
1396
1424
|
});
|
|
1397
1425
|
}
|
|
1398
|
-
|
|
1426
|
+
monitor_12 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1399
1427
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1400
|
-
|
|
1428
|
+
monitor_12.finish();
|
|
1401
1429
|
if (res.acknowledged) {
|
|
1402
1430
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1403
1431
|
resolve(res.modifiedCount);
|
|
@@ -1406,7 +1434,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1406
1434
|
reject(res.acknowledged);
|
|
1407
1435
|
}
|
|
1408
1436
|
}, function (err) {
|
|
1409
|
-
|
|
1437
|
+
monitor_12.finish();
|
|
1410
1438
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1411
1439
|
reject(err);
|
|
1412
1440
|
});
|
|
@@ -1433,9 +1461,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1433
1461
|
else {
|
|
1434
1462
|
options.returnDocument = 'before';
|
|
1435
1463
|
}
|
|
1436
|
-
|
|
1464
|
+
monitor_13 = new monitor_manager_1.MonitorMongo('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1437
1465
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1438
|
-
|
|
1466
|
+
monitor_13.finish();
|
|
1439
1467
|
var doc = res.value;
|
|
1440
1468
|
if (doc) {
|
|
1441
1469
|
log_collection_1.Logs.insertOne({
|
|
@@ -1468,15 +1496,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1468
1496
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1469
1497
|
resolve(res.ok);
|
|
1470
1498
|
}, function (err) {
|
|
1471
|
-
|
|
1499
|
+
monitor_13.finish();
|
|
1472
1500
|
console.log(new Date(), 'Error Find One And Replace', _this.collectionName, filter, replacement, options, err);
|
|
1473
1501
|
reject(err);
|
|
1474
1502
|
});
|
|
1475
1503
|
}
|
|
1476
1504
|
else {
|
|
1477
|
-
|
|
1505
|
+
monitor_14 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1478
1506
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1479
|
-
|
|
1507
|
+
monitor_14.finish();
|
|
1480
1508
|
if (res.acknowledged) {
|
|
1481
1509
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1482
1510
|
resolve(res.modifiedCount);
|
|
@@ -1485,7 +1513,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1485
1513
|
reject(res.acknowledged);
|
|
1486
1514
|
}
|
|
1487
1515
|
}, function (err) {
|
|
1488
|
-
|
|
1516
|
+
monitor_14.finish();
|
|
1489
1517
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1490
1518
|
reject(err);
|
|
1491
1519
|
});
|
|
@@ -1608,7 +1636,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1608
1636
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1609
1637
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1610
1638
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1611
|
-
var validation, isValid, date, doc, versionDoc, monitor_16, monitor_17, monitor_18
|
|
1639
|
+
var validation, isValid, date, doc, versionDoc, monitor_15, monitor_16, monitor_17, monitor_18;
|
|
1612
1640
|
var _this = this;
|
|
1613
1641
|
return __generator(this, function (_a) {
|
|
1614
1642
|
switch (_a.label) {
|
|
@@ -1669,9 +1697,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1669
1697
|
update.$inc.__v = 1;
|
|
1670
1698
|
}
|
|
1671
1699
|
}
|
|
1672
|
-
|
|
1700
|
+
monitor_15 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1673
1701
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1674
|
-
|
|
1702
|
+
monitor_15.finish();
|
|
1675
1703
|
if (res.acknowledged) {
|
|
1676
1704
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1677
1705
|
resolve(res.modifiedCount);
|
|
@@ -1680,7 +1708,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1680
1708
|
reject(res.acknowledged);
|
|
1681
1709
|
}
|
|
1682
1710
|
}, function (err) {
|
|
1683
|
-
|
|
1711
|
+
monitor_15.finish();
|
|
1684
1712
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1685
1713
|
reject(err);
|
|
1686
1714
|
});
|
|
@@ -1723,9 +1751,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1723
1751
|
route: ''
|
|
1724
1752
|
});
|
|
1725
1753
|
}
|
|
1726
|
-
|
|
1754
|
+
monitor_16 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1727
1755
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1728
|
-
|
|
1756
|
+
monitor_16.finish();
|
|
1729
1757
|
if (res.acknowledged) {
|
|
1730
1758
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1731
1759
|
resolve(res.modifiedCount);
|
|
@@ -1734,7 +1762,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1734
1762
|
reject(res.acknowledged);
|
|
1735
1763
|
}
|
|
1736
1764
|
}, function (err) {
|
|
1737
|
-
|
|
1765
|
+
monitor_16.finish();
|
|
1738
1766
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1739
1767
|
reject(err);
|
|
1740
1768
|
});
|
|
@@ -1774,9 +1802,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1774
1802
|
else {
|
|
1775
1803
|
options.returnDocument = 'before';
|
|
1776
1804
|
}
|
|
1777
|
-
|
|
1805
|
+
monitor_17 = new monitor_manager_1.MonitorMongo('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1778
1806
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1779
|
-
|
|
1807
|
+
monitor_17.finish();
|
|
1780
1808
|
var doc = res.value;
|
|
1781
1809
|
if (doc) {
|
|
1782
1810
|
log_collection_1.Logs.insertOne({
|
|
@@ -1813,15 +1841,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1813
1841
|
resolve(0);
|
|
1814
1842
|
}
|
|
1815
1843
|
}, function (err) {
|
|
1816
|
-
|
|
1844
|
+
monitor_17.finish();
|
|
1817
1845
|
console.log(new Date(), 'Error Find One And Update', _this.collectionName, filter, update, options, err);
|
|
1818
1846
|
reject(err);
|
|
1819
1847
|
});
|
|
1820
1848
|
}
|
|
1821
1849
|
else {
|
|
1822
|
-
|
|
1850
|
+
monitor_18 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1823
1851
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1824
|
-
|
|
1852
|
+
monitor_18.finish();
|
|
1825
1853
|
if (res.acknowledged) {
|
|
1826
1854
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1827
1855
|
resolve(res.modifiedCount);
|
|
@@ -1830,7 +1858,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1830
1858
|
reject(res.acknowledged);
|
|
1831
1859
|
}
|
|
1832
1860
|
}, function (err) {
|
|
1833
|
-
|
|
1861
|
+
monitor_18.finish();
|
|
1834
1862
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1835
1863
|
reject(err);
|
|
1836
1864
|
});
|