@resolveio/server-lib 12.6.6 → 12.6.7
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.
|
@@ -124,6 +124,7 @@ export declare class MongoManagerCollection<T extends CollectionDocument> {
|
|
|
124
124
|
useRB: boolean;
|
|
125
125
|
collectionOptions: CreateCollectionOptions;
|
|
126
126
|
constructor(options: MongoManagerCollectionOptions);
|
|
127
|
+
private static indexQueue;
|
|
127
128
|
aggregate(pipeline: object[], options?: AggregateOptions, skipCache?: boolean): Promise<any[]>;
|
|
128
129
|
aggregateCount(pipeline: object[], options?: AggregateOptions): Promise<number>;
|
|
129
130
|
aggregateCursor(pipeline: object[], options?: AggregateOptions): AggregationCursor;
|
|
@@ -74,6 +74,7 @@ var monitor_manager_1 = require("./monitor.manager");
|
|
|
74
74
|
var os_1 = require("os");
|
|
75
75
|
var numCPUs = (0, os_1.cpus)().length;
|
|
76
76
|
var v8 = require('v8');
|
|
77
|
+
var async_1 = require("async");
|
|
77
78
|
var MongoManager = /** @class */ (function () {
|
|
78
79
|
function MongoManager() {
|
|
79
80
|
var _this = this;
|
|
@@ -582,33 +583,33 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
582
583
|
MongoManagerCollection.prototype.createIndex = function (fieldOrSpec, options) {
|
|
583
584
|
var _this = this;
|
|
584
585
|
return new Promise(function (resolve, reject) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
console.log(new Date(), 'Error Setting Up Index for Collection', _this.collectionName, fieldOrSpec, options, err);
|
|
586
|
+
MongoManagerCollection.indexQueue.push({
|
|
587
|
+
action: 'createIndex',
|
|
588
|
+
collection: _this,
|
|
589
|
+
specs: [fieldOrSpec],
|
|
590
|
+
options: options
|
|
591
|
+
}, function (err, result) {
|
|
592
|
+
if (err)
|
|
593
593
|
reject(err);
|
|
594
|
-
|
|
595
|
-
|
|
594
|
+
else
|
|
595
|
+
resolve(result);
|
|
596
|
+
});
|
|
596
597
|
});
|
|
597
598
|
};
|
|
598
599
|
MongoManagerCollection.prototype.createIndexes = function (indexSpecs, options) {
|
|
599
600
|
var _this = this;
|
|
600
601
|
return new Promise(function (resolve, reject) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
console.log(new Date(), 'Error Setting Up Indexes for Collection', _this.collectionName, indexSpecs, options, err);
|
|
602
|
+
MongoManagerCollection.indexQueue.push({
|
|
603
|
+
action: 'createIndexes',
|
|
604
|
+
collection: _this,
|
|
605
|
+
specs: [indexSpecs],
|
|
606
|
+
options: options
|
|
607
|
+
}, function (err, result) {
|
|
608
|
+
if (err)
|
|
609
609
|
reject(err);
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
else
|
|
611
|
+
resolve(result);
|
|
612
|
+
});
|
|
612
613
|
});
|
|
613
614
|
};
|
|
614
615
|
MongoManagerCollection.prototype.deleteMany = function (filter, options, bypassLogs) {
|
|
@@ -673,15 +674,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
673
674
|
if (filter === void 0) { filter = {}; }
|
|
674
675
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
675
676
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
676
|
-
var
|
|
677
|
+
var monitor_3, monitor_4;
|
|
677
678
|
var _this = this;
|
|
678
679
|
return __generator(this, function (_a) {
|
|
679
680
|
if (this.createLogs && !bypassLogs) {
|
|
680
|
-
|
|
681
|
+
monitor_3 = new monitor_manager_1.MonitorMongo('findOneAndDelete', this.collectionName, JSON.stringify([filter, options]));
|
|
681
682
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndDelete(filter, options).then(function (returnVal) { return __awaiter(_this, void 0, void 0, function () {
|
|
682
683
|
var doc, versionDoc;
|
|
683
684
|
return __generator(this, function (_a) {
|
|
684
|
-
|
|
685
|
+
monitor_3.finish();
|
|
685
686
|
doc = returnVal.value;
|
|
686
687
|
if (doc) {
|
|
687
688
|
if (this.createLogs && !bypassLogs) {
|
|
@@ -713,15 +714,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
713
714
|
return [2 /*return*/];
|
|
714
715
|
});
|
|
715
716
|
}); }, function (err) {
|
|
716
|
-
|
|
717
|
+
monitor_3.finish();
|
|
717
718
|
console.log(new Date(), 'Error Find One And Delete', _this.collectionName, filter, options, err);
|
|
718
719
|
reject(err);
|
|
719
720
|
});
|
|
720
721
|
}
|
|
721
722
|
else {
|
|
722
|
-
|
|
723
|
+
monitor_4 = new monitor_manager_1.MonitorMongo('deleteOne', this.collectionName, JSON.stringify([filter, options]));
|
|
723
724
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options).then(function (res) {
|
|
724
|
-
|
|
725
|
+
monitor_4.finish();
|
|
725
726
|
if (res.acknowledged) {
|
|
726
727
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
727
728
|
resolve(res.deletedCount);
|
|
@@ -730,7 +731,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
730
731
|
reject(res.acknowledged);
|
|
731
732
|
}
|
|
732
733
|
}, function (err) {
|
|
733
|
-
|
|
734
|
+
monitor_4.finish();
|
|
734
735
|
console.log(new Date(), 'Error Delete One', _this.collectionName, filter, options, err);
|
|
735
736
|
reject(err);
|
|
736
737
|
});
|
|
@@ -800,7 +801,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
800
801
|
if (filter === void 0) { filter = {}; }
|
|
801
802
|
if (skipCache === void 0) { skipCache = false; }
|
|
802
803
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
803
|
-
var
|
|
804
|
+
var monitor_5;
|
|
804
805
|
var _this = this;
|
|
805
806
|
return __generator(this, function (_a) {
|
|
806
807
|
if (!skipCache) {
|
|
@@ -828,12 +829,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
828
829
|
});
|
|
829
830
|
}
|
|
830
831
|
else {
|
|
831
|
-
|
|
832
|
+
monitor_5 = new monitor_manager_1.MonitorMongo('find', this.collectionName, JSON.stringify([filter, options]));
|
|
832
833
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options).toArray().then(function (res) {
|
|
833
|
-
|
|
834
|
+
monitor_5.finish();
|
|
834
835
|
resolve(res);
|
|
835
836
|
}, function (err) {
|
|
836
|
-
|
|
837
|
+
monitor_5.finish();
|
|
837
838
|
console.log(new Date(), 'Error Find', _this.collectionName, filter, options, err);
|
|
838
839
|
reject(err);
|
|
839
840
|
});
|
|
@@ -921,12 +922,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
921
922
|
});
|
|
922
923
|
}
|
|
923
924
|
else {
|
|
924
|
-
var
|
|
925
|
+
var monitor_6 = new monitor_manager_1.MonitorMongo('findOne', _this.collectionName, JSON.stringify([filter, options]));
|
|
925
926
|
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).findOne(filter, options).then(function (res) {
|
|
926
|
-
|
|
927
|
+
monitor_6.finish();
|
|
927
928
|
resolve(res);
|
|
928
929
|
}, function (err) {
|
|
929
|
-
|
|
930
|
+
monitor_6.finish();
|
|
930
931
|
console.log(new Date(), 'Error Find One', _this.collectionName, filter, options, err);
|
|
931
932
|
reject(err);
|
|
932
933
|
});
|
|
@@ -1177,7 +1178,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1177
1178
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1178
1179
|
if (bypassMonitor === void 0) { bypassMonitor = false; }
|
|
1179
1180
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1180
|
-
var validationResults, validDocs, i, doc, date,
|
|
1181
|
+
var validationResults, validDocs, i, doc, date, monitor_7;
|
|
1181
1182
|
var _this = this;
|
|
1182
1183
|
return __generator(this, function (_a) {
|
|
1183
1184
|
if (!docs.length) {
|
|
@@ -1226,13 +1227,13 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1226
1227
|
}
|
|
1227
1228
|
}
|
|
1228
1229
|
if (validDocs.length) {
|
|
1229
|
-
|
|
1230
|
+
monitor_7 = null;
|
|
1230
1231
|
if (!bypassMonitor) {
|
|
1231
|
-
|
|
1232
|
+
monitor_7 = new monitor_manager_1.MonitorMongo('insertMany', this.collectionName, JSON.stringify([validDocs, options]));
|
|
1232
1233
|
}
|
|
1233
1234
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options).then(function (res) {
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1235
|
+
if (monitor_7) {
|
|
1236
|
+
monitor_7.finish();
|
|
1236
1237
|
}
|
|
1237
1238
|
if (res.acknowledged) {
|
|
1238
1239
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1242,8 +1243,8 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1242
1243
|
reject(res.acknowledged);
|
|
1243
1244
|
}
|
|
1244
1245
|
}, function (err) {
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1246
|
+
if (monitor_7) {
|
|
1247
|
+
monitor_7.finish();
|
|
1247
1248
|
}
|
|
1248
1249
|
console.log(new Date(), 'Error Insert Many', _this.collectionName, validDocs, options, err);
|
|
1249
1250
|
reject(err);
|
|
@@ -1344,7 +1345,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1344
1345
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1345
1346
|
if (doc === void 0) { doc = null; }
|
|
1346
1347
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1347
|
-
var validation, isValid, date, versionDoc,
|
|
1348
|
+
var validation, isValid, date, versionDoc, monitor_8, prevDoc, docId, docVersion, updatedDoc_1, monitor_9, monitor_10, monitor_11, monitor_12;
|
|
1348
1349
|
var _this = this;
|
|
1349
1350
|
return __generator(this, function (_a) {
|
|
1350
1351
|
switch (_a.label) {
|
|
@@ -1396,9 +1397,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1396
1397
|
route: ''
|
|
1397
1398
|
});
|
|
1398
1399
|
}
|
|
1399
|
-
|
|
1400
|
+
monitor_8 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1400
1401
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1401
|
-
|
|
1402
|
+
monitor_8.finish();
|
|
1402
1403
|
if (res.acknowledged) {
|
|
1403
1404
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1404
1405
|
resolve(res.modifiedCount);
|
|
@@ -1407,7 +1408,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1407
1408
|
reject(res.acknowledged);
|
|
1408
1409
|
}
|
|
1409
1410
|
}, function (err) {
|
|
1410
|
-
|
|
1411
|
+
monitor_8.finish();
|
|
1411
1412
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1412
1413
|
reject(err);
|
|
1413
1414
|
});
|
|
@@ -1442,9 +1443,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1442
1443
|
route: ''
|
|
1443
1444
|
});
|
|
1444
1445
|
}
|
|
1445
|
-
|
|
1446
|
+
monitor_9 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc_1, options]));
|
|
1446
1447
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, updatedDoc_1, options).then(function (res) {
|
|
1447
|
-
|
|
1448
|
+
monitor_9.finish();
|
|
1448
1449
|
if (res.acknowledged) {
|
|
1449
1450
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1450
1451
|
resolve(res.modifiedCount);
|
|
@@ -1453,7 +1454,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1453
1454
|
reject(res.acknowledged);
|
|
1454
1455
|
}
|
|
1455
1456
|
}, function (err) {
|
|
1456
|
-
|
|
1457
|
+
monitor_9.finish();
|
|
1457
1458
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, updatedDoc_1, options, err);
|
|
1458
1459
|
reject(err);
|
|
1459
1460
|
});
|
|
@@ -1486,9 +1487,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1486
1487
|
route: ''
|
|
1487
1488
|
});
|
|
1488
1489
|
}
|
|
1489
|
-
|
|
1490
|
+
monitor_10 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1490
1491
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1491
|
-
|
|
1492
|
+
monitor_10.finish();
|
|
1492
1493
|
if (res.acknowledged) {
|
|
1493
1494
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1494
1495
|
resolve(res.modifiedCount);
|
|
@@ -1497,7 +1498,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1497
1498
|
reject(res.acknowledged);
|
|
1498
1499
|
}
|
|
1499
1500
|
}, function (err) {
|
|
1500
|
-
|
|
1501
|
+
monitor_10.finish();
|
|
1501
1502
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1502
1503
|
reject(err);
|
|
1503
1504
|
});
|
|
@@ -1524,9 +1525,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1524
1525
|
else {
|
|
1525
1526
|
options.returnDocument = 'before';
|
|
1526
1527
|
}
|
|
1527
|
-
|
|
1528
|
+
monitor_11 = new monitor_manager_1.MonitorMongo('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1528
1529
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1529
|
-
|
|
1530
|
+
monitor_11.finish();
|
|
1530
1531
|
var doc = res.value;
|
|
1531
1532
|
if (doc) {
|
|
1532
1533
|
log_collection_1.Logs.insertOne({
|
|
@@ -1559,15 +1560,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1559
1560
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1560
1561
|
resolve(res.ok);
|
|
1561
1562
|
}, function (err) {
|
|
1562
|
-
|
|
1563
|
+
monitor_11.finish();
|
|
1563
1564
|
console.log(new Date(), 'Error Find One And Replace', _this.collectionName, filter, replacement, options, err);
|
|
1564
1565
|
reject(err);
|
|
1565
1566
|
});
|
|
1566
1567
|
}
|
|
1567
1568
|
else {
|
|
1568
|
-
|
|
1569
|
+
monitor_12 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1569
1570
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1570
|
-
|
|
1571
|
+
monitor_12.finish();
|
|
1571
1572
|
if (res.acknowledged) {
|
|
1572
1573
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1573
1574
|
resolve(res.modifiedCount);
|
|
@@ -1576,7 +1577,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1576
1577
|
reject(res.acknowledged);
|
|
1577
1578
|
}
|
|
1578
1579
|
}, function (err) {
|
|
1579
|
-
|
|
1580
|
+
monitor_12.finish();
|
|
1580
1581
|
console.log(new Date(), 'Error Replace One', _this.collectionName, filter, replacement, options, err);
|
|
1581
1582
|
reject(err);
|
|
1582
1583
|
});
|
|
@@ -1699,7 +1700,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1699
1700
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1700
1701
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1701
1702
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1702
|
-
var validation, isValid, date, doc, versionDoc,
|
|
1703
|
+
var validation, isValid, date, doc, versionDoc, monitor_13, monitor_14, monitor_15, monitor_16;
|
|
1703
1704
|
var _this = this;
|
|
1704
1705
|
return __generator(this, function (_a) {
|
|
1705
1706
|
switch (_a.label) {
|
|
@@ -1760,9 +1761,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1760
1761
|
update.$inc.__v = 1;
|
|
1761
1762
|
}
|
|
1762
1763
|
}
|
|
1763
|
-
|
|
1764
|
+
monitor_13 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1764
1765
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1765
|
-
|
|
1766
|
+
monitor_13.finish();
|
|
1766
1767
|
if (res.acknowledged) {
|
|
1767
1768
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1768
1769
|
resolve(res.modifiedCount);
|
|
@@ -1771,7 +1772,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1771
1772
|
reject(res.acknowledged);
|
|
1772
1773
|
}
|
|
1773
1774
|
}, function (err) {
|
|
1774
|
-
|
|
1775
|
+
monitor_13.finish();
|
|
1775
1776
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1776
1777
|
reject(err);
|
|
1777
1778
|
});
|
|
@@ -1814,9 +1815,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1814
1815
|
route: ''
|
|
1815
1816
|
});
|
|
1816
1817
|
}
|
|
1817
|
-
|
|
1818
|
+
monitor_14 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1818
1819
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1819
|
-
|
|
1820
|
+
monitor_14.finish();
|
|
1820
1821
|
if (res.acknowledged) {
|
|
1821
1822
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1822
1823
|
resolve(res.modifiedCount);
|
|
@@ -1825,7 +1826,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1825
1826
|
reject(res.acknowledged);
|
|
1826
1827
|
}
|
|
1827
1828
|
}, function (err) {
|
|
1828
|
-
|
|
1829
|
+
monitor_14.finish();
|
|
1829
1830
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1830
1831
|
reject(err);
|
|
1831
1832
|
});
|
|
@@ -1865,9 +1866,9 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1865
1866
|
else {
|
|
1866
1867
|
options.returnDocument = 'before';
|
|
1867
1868
|
}
|
|
1868
|
-
|
|
1869
|
+
monitor_15 = new monitor_manager_1.MonitorMongo('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1869
1870
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1870
|
-
|
|
1871
|
+
monitor_15.finish();
|
|
1871
1872
|
var doc = res.value;
|
|
1872
1873
|
if (doc) {
|
|
1873
1874
|
log_collection_1.Logs.insertOne({
|
|
@@ -1904,15 +1905,15 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1904
1905
|
resolve(0);
|
|
1905
1906
|
}
|
|
1906
1907
|
}, function (err) {
|
|
1907
|
-
|
|
1908
|
+
monitor_15.finish();
|
|
1908
1909
|
console.log(new Date(), 'Error Find One And Update', _this.collectionName, filter, update, options, err);
|
|
1909
1910
|
reject(err);
|
|
1910
1911
|
});
|
|
1911
1912
|
}
|
|
1912
1913
|
else {
|
|
1913
|
-
|
|
1914
|
+
monitor_16 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1914
1915
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1915
|
-
|
|
1916
|
+
monitor_16.finish();
|
|
1916
1917
|
if (res.acknowledged) {
|
|
1917
1918
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1918
1919
|
resolve(res.modifiedCount);
|
|
@@ -1921,7 +1922,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1921
1922
|
reject(res.acknowledged);
|
|
1922
1923
|
}
|
|
1923
1924
|
}, function (err) {
|
|
1924
|
-
|
|
1925
|
+
monitor_16.finish();
|
|
1925
1926
|
console.log(new Date(), 'Error Update One', _this.collectionName, filter, update, options, err);
|
|
1926
1927
|
reject(err);
|
|
1927
1928
|
});
|
|
@@ -1952,6 +1953,22 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1952
1953
|
});
|
|
1953
1954
|
return stream;
|
|
1954
1955
|
};
|
|
1956
|
+
MongoManagerCollection.indexQueue = async_1.default.queue(function (task, callback) {
|
|
1957
|
+
var action = task.action, collection = task.collection, specs = task.specs, options = task.options;
|
|
1958
|
+
var dbCollection = index_1.ResolveIOServer.getMainDB().collection(collection.collectionName, collection.collectionOptions);
|
|
1959
|
+
if (!dbCollection) {
|
|
1960
|
+
return callback(new Error("Collection ".concat(collection.collectionName, " not found")));
|
|
1961
|
+
}
|
|
1962
|
+
var monitor = new monitor_manager_1.MonitorMongo(action, collection.collectionName, JSON.stringify([specs, options]));
|
|
1963
|
+
dbCollection[action].apply(dbCollection, __spreadArray(__spreadArray([], specs, false), [options], false)).then(function (res) {
|
|
1964
|
+
monitor.finish();
|
|
1965
|
+
callback(null, res);
|
|
1966
|
+
}).catch(function (err) {
|
|
1967
|
+
monitor.finish();
|
|
1968
|
+
console.log(new Date(), "Error Setting Up ".concat(action === 'createIndex' ? 'Index' : 'Indexes', " for Collection"), collection.collectionName, specs, options, err);
|
|
1969
|
+
callback(err);
|
|
1970
|
+
});
|
|
1971
|
+
}, 1);
|
|
1955
1972
|
return MongoManagerCollection;
|
|
1956
1973
|
}());
|
|
1957
1974
|
exports.MongoManagerCollection = MongoManagerCollection;
|