@resolveio/server-lib 12.5.11 → 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.
|
@@ -407,43 +407,52 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
407
407
|
var _this = this;
|
|
408
408
|
if (skipCache === void 0) { skipCache = false; }
|
|
409
409
|
return new Promise(function (resolve, reject) {
|
|
410
|
-
if (!skipCache) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
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
|
+
});
|
|
447
456
|
});
|
|
448
457
|
};
|
|
449
458
|
MongoManagerCollection.prototype.aggregateCount = function (pipeline, options) {
|
|
@@ -519,12 +528,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
519
528
|
var _this = this;
|
|
520
529
|
return new Promise(function (resolve, reject) {
|
|
521
530
|
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
522
|
-
var
|
|
531
|
+
var monitor_3 = new monitor_manager_1.MonitorMongo('createIndex', _this.collectionName, JSON.stringify([fieldOrSpec, options]));
|
|
523
532
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndex(fieldOrSpec, options).then(function (res) {
|
|
524
|
-
|
|
533
|
+
monitor_3.finish();
|
|
525
534
|
resolve(res);
|
|
526
535
|
}, function (err) {
|
|
527
|
-
|
|
536
|
+
monitor_3.finish();
|
|
528
537
|
console.log(new Date(), 'Error Setting Up Index for Collection', _this.collectionName, fieldOrSpec, options, err);
|
|
529
538
|
reject(err);
|
|
530
539
|
});
|
|
@@ -535,12 +544,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
535
544
|
var _this = this;
|
|
536
545
|
return new Promise(function (resolve, reject) {
|
|
537
546
|
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
538
|
-
var
|
|
547
|
+
var monitor_4 = new monitor_manager_1.MonitorMongo('createIndexes', _this.collectionName, JSON.stringify([indexSpecs, options]));
|
|
539
548
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndexes(indexSpecs, options).then(function (res) {
|
|
540
|
-
|
|
549
|
+
monitor_4.finish();
|
|
541
550
|
resolve(res);
|
|
542
551
|
}, function (err) {
|
|
543
|
-
|
|
552
|
+
monitor_4.finish();
|
|
544
553
|
console.log(new Date(), 'Error Setting Up Indexes for Collection', _this.collectionName, indexSpecs, options, err);
|
|
545
554
|
reject(err);
|
|
546
555
|
});
|
|
@@ -609,15 +618,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
609
618
|
if (filter === void 0) { filter = {}; }
|
|
610
619
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
611
620
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
612
|
-
var
|
|
621
|
+
var monitor_5, monitor_6;
|
|
613
622
|
var _this = this;
|
|
614
623
|
return __generator(this, function (_a) {
|
|
615
624
|
if (this.createLogs && !bypassLogs) {
|
|
616
|
-
|
|
625
|
+
monitor_5 = new monitor_manager_1.MonitorMongo('findOneAndDelete', this.collectionName, JSON.stringify([filter, options]));
|
|
617
626
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndDelete(filter, options).then(function (returnVal) { return __awaiter(_this, void 0, void 0, function () {
|
|
618
627
|
var doc, versionDoc;
|
|
619
628
|
return __generator(this, function (_a) {
|
|
620
|
-
|
|
629
|
+
monitor_5.finish();
|
|
621
630
|
doc = returnVal.value;
|
|
622
631
|
if (doc) {
|
|
623
632
|
if (this.createLogs && !bypassLogs) {
|
|
@@ -649,15 +658,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
649
658
|
return [2 /*return*/];
|
|
650
659
|
});
|
|
651
660
|
}); }, function (err) {
|
|
652
|
-
|
|
661
|
+
monitor_5.finish();
|
|
653
662
|
console.log(new Date(), 'Error Find One And Delete', _this.collectionName, filter, options, err);
|
|
654
663
|
reject(err);
|
|
655
664
|
});
|
|
656
665
|
}
|
|
657
666
|
else {
|
|
658
|
-
|
|
667
|
+
monitor_6 = new monitor_manager_1.MonitorMongo('deleteOne', this.collectionName, JSON.stringify([filter, options]));
|
|
659
668
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options).then(function (res) {
|
|
660
|
-
|
|
669
|
+
monitor_6.finish();
|
|
661
670
|
if (res.acknowledged) {
|
|
662
671
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
663
672
|
resolve(res.deletedCount);
|
|
@@ -666,7 +675,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
666
675
|
reject(res.acknowledged);
|
|
667
676
|
}
|
|
668
677
|
}, function (err) {
|
|
669
|
-
|
|
678
|
+
monitor_6.finish();
|
|
670
679
|
console.log(new Date(), 'Error Delete One', _this.collectionName, filter, options, err);
|
|
671
680
|
reject(err);
|
|
672
681
|
});
|
|
@@ -736,7 +745,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
736
745
|
if (filter === void 0) { filter = {}; }
|
|
737
746
|
if (skipCache === void 0) { skipCache = false; }
|
|
738
747
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
739
|
-
var
|
|
748
|
+
var monitor_7;
|
|
740
749
|
var _this = this;
|
|
741
750
|
return __generator(this, function (_a) {
|
|
742
751
|
if (!skipCache) {
|
|
@@ -764,12 +773,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
764
773
|
});
|
|
765
774
|
}
|
|
766
775
|
else {
|
|
767
|
-
|
|
776
|
+
monitor_7 = new monitor_manager_1.MonitorMongo('find', this.collectionName, JSON.stringify([filter, options]));
|
|
768
777
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options).toArray().then(function (res) {
|
|
769
|
-
|
|
778
|
+
monitor_7.finish();
|
|
770
779
|
resolve(res);
|
|
771
780
|
}, function (err) {
|
|
772
|
-
|
|
781
|
+
monitor_7.finish();
|
|
773
782
|
console.log(new Date(), 'Error Find', _this.collectionName, filter, options, err);
|
|
774
783
|
reject(err);
|
|
775
784
|
});
|
|
@@ -857,12 +866,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
857
866
|
});
|
|
858
867
|
}
|
|
859
868
|
else {
|
|
860
|
-
var
|
|
869
|
+
var monitor_8 = new monitor_manager_1.MonitorMongo('findOne', _this.collectionName, JSON.stringify([filter, options]));
|
|
861
870
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).findOne(filter, options).then(function (res) {
|
|
862
|
-
|
|
871
|
+
monitor_8.finish();
|
|
863
872
|
resolve(res);
|
|
864
873
|
}, function (err) {
|
|
865
|
-
|
|
874
|
+
monitor_8.finish();
|
|
866
875
|
console.log(new Date(), 'Error Find One', _this.collectionName, filter, options, err);
|
|
867
876
|
reject(err);
|
|
868
877
|
});
|
|
@@ -1112,7 +1121,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1112
1121
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1113
1122
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1114
1123
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1115
|
-
var validationResults, validDocs, i, doc, date,
|
|
1124
|
+
var validationResults, validDocs, i, doc, date, monitor_9;
|
|
1116
1125
|
var _this = this;
|
|
1117
1126
|
return __generator(this, function (_a) {
|
|
1118
1127
|
if (!docs.length) {
|
|
@@ -1161,9 +1170,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1161
1170
|
}
|
|
1162
1171
|
}
|
|
1163
1172
|
if (validDocs.length) {
|
|
1164
|
-
|
|
1173
|
+
monitor_9 = new monitor_manager_1.MonitorMongo('insertMany', this.collectionName, JSON.stringify([validDocs, options]));
|
|
1165
1174
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options).then(function (res) {
|
|
1166
|
-
|
|
1175
|
+
monitor_9.finish();
|
|
1167
1176
|
if (res.acknowledged) {
|
|
1168
1177
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1169
1178
|
resolve(validDocs);
|
|
@@ -1172,7 +1181,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1172
1181
|
reject(res.acknowledged);
|
|
1173
1182
|
}
|
|
1174
1183
|
}, function (err) {
|
|
1175
|
-
|
|
1184
|
+
monitor_9.finish();
|
|
1176
1185
|
console.log(new Date(), 'Error Insert Many', _this.collectionName, validDocs, options, err);
|
|
1177
1186
|
reject(err);
|
|
1178
1187
|
});
|
|
@@ -1272,7 +1281,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1272
1281
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1273
1282
|
if (doc === void 0) { doc = null; }
|
|
1274
1283
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1275
|
-
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;
|
|
1276
1285
|
var _this = this;
|
|
1277
1286
|
return __generator(this, function (_a) {
|
|
1278
1287
|
switch (_a.label) {
|
|
@@ -1324,9 +1333,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1324
1333
|
route: ''
|
|
1325
1334
|
});
|
|
1326
1335
|
}
|
|
1327
|
-
|
|
1336
|
+
monitor_10 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1328
1337
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1329
|
-
|
|
1338
|
+
monitor_10.finish();
|
|
1330
1339
|
if (res.acknowledged) {
|
|
1331
1340
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1332
1341
|
resolve(res.modifiedCount);
|
|
@@ -1335,7 +1344,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1335
1344
|
reject(res.acknowledged);
|
|
1336
1345
|
}
|
|
1337
1346
|
}, function (err) {
|
|
1338
|
-
|
|
1347
|
+
monitor_10.finish();
|
|
1339
1348
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1340
1349
|
reject(err);
|
|
1341
1350
|
});
|
|
@@ -1370,9 +1379,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1370
1379
|
route: ''
|
|
1371
1380
|
});
|
|
1372
1381
|
}
|
|
1373
|
-
|
|
1382
|
+
monitor_11 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc_1, options]));
|
|
1374
1383
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, updatedDoc_1, options).then(function (res) {
|
|
1375
|
-
|
|
1384
|
+
monitor_11.finish();
|
|
1376
1385
|
if (res.acknowledged) {
|
|
1377
1386
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1378
1387
|
resolve(res.modifiedCount);
|
|
@@ -1381,7 +1390,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1381
1390
|
reject(res.acknowledged);
|
|
1382
1391
|
}
|
|
1383
1392
|
}, function (err) {
|
|
1384
|
-
|
|
1393
|
+
monitor_11.finish();
|
|
1385
1394
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, updatedDoc_1, options, err);
|
|
1386
1395
|
reject(err);
|
|
1387
1396
|
});
|
|
@@ -1414,9 +1423,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1414
1423
|
route: ''
|
|
1415
1424
|
});
|
|
1416
1425
|
}
|
|
1417
|
-
|
|
1426
|
+
monitor_12 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1418
1427
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1419
|
-
|
|
1428
|
+
monitor_12.finish();
|
|
1420
1429
|
if (res.acknowledged) {
|
|
1421
1430
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1422
1431
|
resolve(res.modifiedCount);
|
|
@@ -1425,7 +1434,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1425
1434
|
reject(res.acknowledged);
|
|
1426
1435
|
}
|
|
1427
1436
|
}, function (err) {
|
|
1428
|
-
|
|
1437
|
+
monitor_12.finish();
|
|
1429
1438
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1430
1439
|
reject(err);
|
|
1431
1440
|
});
|
|
@@ -1452,9 +1461,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1452
1461
|
else {
|
|
1453
1462
|
options.returnDocument = 'before';
|
|
1454
1463
|
}
|
|
1455
|
-
|
|
1464
|
+
monitor_13 = new monitor_manager_1.MonitorMongo('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1456
1465
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1457
|
-
|
|
1466
|
+
monitor_13.finish();
|
|
1458
1467
|
var doc = res.value;
|
|
1459
1468
|
if (doc) {
|
|
1460
1469
|
log_collection_1.Logs.insertOne({
|
|
@@ -1487,15 +1496,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1487
1496
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1488
1497
|
resolve(res.ok);
|
|
1489
1498
|
}, function (err) {
|
|
1490
|
-
|
|
1499
|
+
monitor_13.finish();
|
|
1491
1500
|
console.log(new Date(), 'Error Find One And Replace', _this.collectionName, filter, replacement, options, err);
|
|
1492
1501
|
reject(err);
|
|
1493
1502
|
});
|
|
1494
1503
|
}
|
|
1495
1504
|
else {
|
|
1496
|
-
|
|
1505
|
+
monitor_14 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1497
1506
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1498
|
-
|
|
1507
|
+
monitor_14.finish();
|
|
1499
1508
|
if (res.acknowledged) {
|
|
1500
1509
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1501
1510
|
resolve(res.modifiedCount);
|
|
@@ -1504,7 +1513,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1504
1513
|
reject(res.acknowledged);
|
|
1505
1514
|
}
|
|
1506
1515
|
}, function (err) {
|
|
1507
|
-
|
|
1516
|
+
monitor_14.finish();
|
|
1508
1517
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1509
1518
|
reject(err);
|
|
1510
1519
|
});
|
|
@@ -1627,7 +1636,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1627
1636
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1628
1637
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1629
1638
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1630
|
-
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;
|
|
1631
1640
|
var _this = this;
|
|
1632
1641
|
return __generator(this, function (_a) {
|
|
1633
1642
|
switch (_a.label) {
|
|
@@ -1688,9 +1697,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1688
1697
|
update.$inc.__v = 1;
|
|
1689
1698
|
}
|
|
1690
1699
|
}
|
|
1691
|
-
|
|
1700
|
+
monitor_15 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1692
1701
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1693
|
-
|
|
1702
|
+
monitor_15.finish();
|
|
1694
1703
|
if (res.acknowledged) {
|
|
1695
1704
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1696
1705
|
resolve(res.modifiedCount);
|
|
@@ -1699,7 +1708,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1699
1708
|
reject(res.acknowledged);
|
|
1700
1709
|
}
|
|
1701
1710
|
}, function (err) {
|
|
1702
|
-
|
|
1711
|
+
monitor_15.finish();
|
|
1703
1712
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1704
1713
|
reject(err);
|
|
1705
1714
|
});
|
|
@@ -1742,9 +1751,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1742
1751
|
route: ''
|
|
1743
1752
|
});
|
|
1744
1753
|
}
|
|
1745
|
-
|
|
1754
|
+
monitor_16 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1746
1755
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1747
|
-
|
|
1756
|
+
monitor_16.finish();
|
|
1748
1757
|
if (res.acknowledged) {
|
|
1749
1758
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1750
1759
|
resolve(res.modifiedCount);
|
|
@@ -1753,7 +1762,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1753
1762
|
reject(res.acknowledged);
|
|
1754
1763
|
}
|
|
1755
1764
|
}, function (err) {
|
|
1756
|
-
|
|
1765
|
+
monitor_16.finish();
|
|
1757
1766
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1758
1767
|
reject(err);
|
|
1759
1768
|
});
|
|
@@ -1793,9 +1802,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1793
1802
|
else {
|
|
1794
1803
|
options.returnDocument = 'before';
|
|
1795
1804
|
}
|
|
1796
|
-
|
|
1805
|
+
monitor_17 = new monitor_manager_1.MonitorMongo('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1797
1806
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1798
|
-
|
|
1807
|
+
monitor_17.finish();
|
|
1799
1808
|
var doc = res.value;
|
|
1800
1809
|
if (doc) {
|
|
1801
1810
|
log_collection_1.Logs.insertOne({
|
|
@@ -1832,15 +1841,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1832
1841
|
resolve(0);
|
|
1833
1842
|
}
|
|
1834
1843
|
}, function (err) {
|
|
1835
|
-
|
|
1844
|
+
monitor_17.finish();
|
|
1836
1845
|
console.log(new Date(), 'Error Find One And Update', _this.collectionName, filter, update, options, err);
|
|
1837
1846
|
reject(err);
|
|
1838
1847
|
});
|
|
1839
1848
|
}
|
|
1840
1849
|
else {
|
|
1841
|
-
|
|
1850
|
+
monitor_18 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1842
1851
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1843
|
-
|
|
1852
|
+
monitor_18.finish();
|
|
1844
1853
|
if (res.acknowledged) {
|
|
1845
1854
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1846
1855
|
resolve(res.modifiedCount);
|
|
@@ -1849,7 +1858,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1849
1858
|
reject(res.acknowledged);
|
|
1850
1859
|
}
|
|
1851
1860
|
}, function (err) {
|
|
1852
|
-
|
|
1861
|
+
monitor_18.finish();
|
|
1853
1862
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1854
1863
|
reject(err);
|
|
1855
1864
|
});
|