@resolveio/server-lib 9.7.15 → 9.7.17
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.
- package/index.d.ts +3 -2
- package/index.js +1 -4
- package/index.js.map +1 -1
- package/managers/method.manager.js +1 -1
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.d.ts +39 -56
- package/managers/mongo.manager.js +112 -105
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +82 -6
- package/managers/monitor.manager.js.map +1 -1
- package/managers/subscription.manager.js +40 -40
- package/managers/subscription.manager.js.map +1 -1
- package/methods/accounts.js.map +1 -1
- package/package.json +3 -3
- package/server-app.js +83 -82
- package/server-app.js.map +1 -1
|
@@ -66,6 +66,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
66
66
|
this._collections = [];
|
|
67
67
|
this._mongoQueue = [];
|
|
68
68
|
this._mongoQueueId = 0;
|
|
69
|
+
this._mongoQueueRunning = false;
|
|
69
70
|
this._mongoQueueCacheId = 1;
|
|
70
71
|
this._heapStats = v8.getHeapStatistics();
|
|
71
72
|
this._heapLimit = 0;
|
|
@@ -104,79 +105,85 @@ var MongoManager = /** @class */ (function () {
|
|
|
104
105
|
var _this = this;
|
|
105
106
|
return __generator(this, function (_a) {
|
|
106
107
|
setInterval(function () {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
mongoQueue.cbs = [];
|
|
118
|
-
mongoQueue.running = false;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
mongoQueue.last_run = new Date();
|
|
122
|
-
if (!mongoQueue.name_function_addt) {
|
|
123
|
-
(_a = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_a, mongoQueue.data_function).then(function (res) {
|
|
124
|
-
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
125
|
-
_this._mongoQueueCacheId += 1;
|
|
126
|
-
_this.addToCache(mongoQueue.cacheId, res);
|
|
108
|
+
if (!_this._mongoQueueRunning) {
|
|
109
|
+
var queueArr = _this._mongoQueue.filter(function (a) { return !a.running && a.cbs.length && (!a.next_run || a.next_run.getTime() <= Date.now()); });
|
|
110
|
+
if (queueArr.length) {
|
|
111
|
+
_this._mongoQueueRunning = true;
|
|
112
|
+
var _loop_1 = function (i) {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
var mongoQueue = queueArr[i];
|
|
115
|
+
mongoQueue.running = true;
|
|
116
|
+
if (mongoQueue.cacheId) {
|
|
117
|
+
var res_1 = JSON.parse(_this._nodeCache.get(mongoQueue.cacheId), common_1.dateReviver);
|
|
127
118
|
mongoQueue.cbs.forEach(function (cb) {
|
|
128
|
-
cb(null,
|
|
119
|
+
cb(null, res_1, true);
|
|
129
120
|
});
|
|
130
|
-
|
|
131
|
-
mongoQueue.cbs = mongoQueue.cbs_next;
|
|
132
|
-
mongoQueue.cbs_next = [];
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
mongoQueue.cbs = [];
|
|
136
|
-
}
|
|
121
|
+
mongoQueue.cbs = [];
|
|
137
122
|
mongoQueue.running = false;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
mongoQueue.last_run = new Date();
|
|
126
|
+
if (!mongoQueue.name_function_addt) {
|
|
127
|
+
(_a = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_a, mongoQueue.data_function).then(function (res) {
|
|
128
|
+
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
129
|
+
_this._mongoQueueCacheId += 1;
|
|
130
|
+
_this.addToCache(mongoQueue.cacheId, res);
|
|
131
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
132
|
+
cb(null, res, false);
|
|
133
|
+
});
|
|
134
|
+
if (mongoQueue.cbs_next.length) {
|
|
135
|
+
mongoQueue.cbs = mongoQueue.cbs_next;
|
|
136
|
+
mongoQueue.cbs_next = [];
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
mongoQueue.cbs = [];
|
|
140
|
+
}
|
|
141
|
+
mongoQueue.running = false;
|
|
142
|
+
}, function (err) {
|
|
143
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
144
|
+
cb(err, null, false);
|
|
145
|
+
});
|
|
146
|
+
mongoQueue.cbs_next.forEach(function (cb) {
|
|
147
|
+
cb(err, null, false);
|
|
148
|
+
});
|
|
149
|
+
_this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
|
|
150
|
+
});
|
|
159
151
|
}
|
|
160
152
|
else {
|
|
161
|
-
|
|
153
|
+
(_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) {
|
|
154
|
+
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
155
|
+
_this._mongoQueueCacheId += 1;
|
|
156
|
+
_this.addToCache(mongoQueue.cacheId, res);
|
|
157
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
158
|
+
cb(null, res, false);
|
|
159
|
+
});
|
|
160
|
+
if (mongoQueue.cbs_next.length) {
|
|
161
|
+
mongoQueue.cbs = mongoQueue.cbs_next;
|
|
162
|
+
mongoQueue.cbs_next = [];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
mongoQueue.cbs = [];
|
|
166
|
+
}
|
|
167
|
+
mongoQueue.running = false;
|
|
168
|
+
}, function (err) {
|
|
169
|
+
mongoQueue.cbs.forEach(function (cb) {
|
|
170
|
+
cb(err, null, false);
|
|
171
|
+
});
|
|
172
|
+
mongoQueue.cbs_next.forEach(function (cb) {
|
|
173
|
+
cb(err, null, false);
|
|
174
|
+
});
|
|
175
|
+
_this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
|
|
176
|
+
});
|
|
162
177
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
168
|
-
mongoQueue.cbs_next.forEach(function (cb) {
|
|
169
|
-
cb(err, null, false);
|
|
170
|
-
});
|
|
171
|
-
_this._mongoQueue.splice(_this._mongoQueue.map(function (a) { return a._id; }).indexOf(mongoQueue._id), 1);
|
|
172
|
-
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
for (var i = queueArr.length - 1; i >= 0; i--) {
|
|
181
|
+
_loop_1(i);
|
|
173
182
|
}
|
|
183
|
+
_this._mongoQueueRunning = false;
|
|
174
184
|
}
|
|
175
|
-
};
|
|
176
|
-
for (var i = queueArr.length - 1; i >= 0; i--) {
|
|
177
|
-
_loop_1(i);
|
|
178
185
|
}
|
|
179
|
-
},
|
|
186
|
+
}, 1);
|
|
180
187
|
return [2 /*return*/];
|
|
181
188
|
});
|
|
182
189
|
});
|
|
@@ -423,13 +430,13 @@ var Collection = /** @class */ (function () {
|
|
|
423
430
|
_a.label = 2;
|
|
424
431
|
case 2:
|
|
425
432
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteMany(filter, options).then(function (res) {
|
|
426
|
-
if (res.
|
|
433
|
+
if (res.acknowledged) {
|
|
427
434
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
428
435
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete');
|
|
429
436
|
resolve(res.deletedCount);
|
|
430
437
|
}
|
|
431
438
|
else {
|
|
432
|
-
reject(res.
|
|
439
|
+
reject(res.acknowledged);
|
|
433
440
|
}
|
|
434
441
|
}, function (err) { return reject(err); });
|
|
435
442
|
return [2 /*return*/];
|
|
@@ -482,13 +489,13 @@ var Collection = /** @class */ (function () {
|
|
|
482
489
|
}
|
|
483
490
|
else {
|
|
484
491
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteOne(filter, options).then(function (res) {
|
|
485
|
-
if (res.
|
|
492
|
+
if (res.acknowledged) {
|
|
486
493
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
487
494
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete');
|
|
488
495
|
resolve(res.deletedCount);
|
|
489
496
|
}
|
|
490
497
|
else {
|
|
491
|
-
reject(res.
|
|
498
|
+
reject(res.acknowledged);
|
|
492
499
|
}
|
|
493
500
|
}, function (err) { return reject(err); });
|
|
494
501
|
}
|
|
@@ -571,7 +578,10 @@ var Collection = /** @class */ (function () {
|
|
|
571
578
|
}); });
|
|
572
579
|
};
|
|
573
580
|
Collection.prototype.findById = function (id, options) {
|
|
574
|
-
|
|
581
|
+
var _this = this;
|
|
582
|
+
return new Promise(function (resolve, reject) {
|
|
583
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).findOne({ _id: id }, options).then(function (res) { return resolve(res); }, function (err) { return reject(err); });
|
|
584
|
+
});
|
|
575
585
|
};
|
|
576
586
|
Collection.prototype.findCount = function (filter, options, bypassLogs) {
|
|
577
587
|
if (filter === void 0) { filter = {}; }
|
|
@@ -915,13 +925,13 @@ var Collection = /** @class */ (function () {
|
|
|
915
925
|
}
|
|
916
926
|
if (validDocs.length) {
|
|
917
927
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertMany(validDocs, options).then(function (res) {
|
|
918
|
-
if (res.
|
|
928
|
+
if (res.acknowledged) {
|
|
919
929
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
920
930
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert');
|
|
921
931
|
resolve(validDocs);
|
|
922
932
|
}
|
|
923
933
|
else {
|
|
924
|
-
reject(res.
|
|
934
|
+
reject(res.acknowledged);
|
|
925
935
|
}
|
|
926
936
|
}, function (err) {
|
|
927
937
|
reject(err);
|
|
@@ -975,13 +985,13 @@ var Collection = /** @class */ (function () {
|
|
|
975
985
|
doc['__v'] = 0;
|
|
976
986
|
}
|
|
977
987
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertOne(doc, options).then(function (res) {
|
|
978
|
-
if (res.
|
|
988
|
+
if (res.acknowledged) {
|
|
979
989
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
980
990
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert');
|
|
981
991
|
resolve(doc);
|
|
982
992
|
}
|
|
983
993
|
else {
|
|
984
|
-
reject(res.
|
|
994
|
+
reject(res.acknowledged);
|
|
985
995
|
}
|
|
986
996
|
}, function (err) {
|
|
987
997
|
reject(err);
|
|
@@ -993,9 +1003,6 @@ var Collection = /** @class */ (function () {
|
|
|
993
1003
|
Collection.prototype.listIndexes = function (options) {
|
|
994
1004
|
return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).listIndexes(options);
|
|
995
1005
|
};
|
|
996
|
-
Collection.prototype.reIndex = function (options) {
|
|
997
|
-
return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).reIndex(options);
|
|
998
|
-
};
|
|
999
1006
|
Collection.prototype.rename = function (newName, options) {
|
|
1000
1007
|
return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).rename(newName, options);
|
|
1001
1008
|
};
|
|
@@ -1039,7 +1046,7 @@ var Collection = /** @class */ (function () {
|
|
|
1039
1046
|
replacement['__v'] += 1;
|
|
1040
1047
|
versionDoc = common_1.deepCopy(doc);
|
|
1041
1048
|
versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
|
|
1042
|
-
index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc,
|
|
1049
|
+
index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, options);
|
|
1043
1050
|
if (doc['__v'] >= 4) {
|
|
1044
1051
|
index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany({
|
|
1045
1052
|
_id: {
|
|
@@ -1063,13 +1070,13 @@ var Collection = /** @class */ (function () {
|
|
|
1063
1070
|
});
|
|
1064
1071
|
}
|
|
1065
1072
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1066
|
-
if (res.
|
|
1073
|
+
if (res.acknowledged) {
|
|
1067
1074
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1068
1075
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1069
|
-
resolve(res.
|
|
1076
|
+
resolve(res.modifiedCount);
|
|
1070
1077
|
}
|
|
1071
1078
|
else {
|
|
1072
|
-
reject(res.
|
|
1079
|
+
reject(res.acknowledged);
|
|
1073
1080
|
}
|
|
1074
1081
|
}, function (err) {
|
|
1075
1082
|
reject(err);
|
|
@@ -1106,13 +1113,13 @@ var Collection = /** @class */ (function () {
|
|
|
1106
1113
|
});
|
|
1107
1114
|
}
|
|
1108
1115
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, updatedDoc, options).then(function (res) {
|
|
1109
|
-
if (res.
|
|
1116
|
+
if (res.acknowledged) {
|
|
1110
1117
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1111
1118
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1112
|
-
resolve(res.
|
|
1119
|
+
resolve(res.modifiedCount);
|
|
1113
1120
|
}
|
|
1114
1121
|
else {
|
|
1115
|
-
reject(res.
|
|
1122
|
+
reject(res.acknowledged);
|
|
1116
1123
|
}
|
|
1117
1124
|
}, function (err) {
|
|
1118
1125
|
reject(err);
|
|
@@ -1147,13 +1154,13 @@ var Collection = /** @class */ (function () {
|
|
|
1147
1154
|
});
|
|
1148
1155
|
}
|
|
1149
1156
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1150
|
-
if (res.
|
|
1157
|
+
if (res.acknowledged) {
|
|
1151
1158
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1152
1159
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1153
|
-
resolve(res.
|
|
1160
|
+
resolve(res.modifiedCount);
|
|
1154
1161
|
}
|
|
1155
1162
|
else {
|
|
1156
|
-
reject(res.
|
|
1163
|
+
reject(res.acknowledged);
|
|
1157
1164
|
}
|
|
1158
1165
|
}, function (err) {
|
|
1159
1166
|
reject(err);
|
|
@@ -1176,10 +1183,10 @@ var Collection = /** @class */ (function () {
|
|
|
1176
1183
|
}
|
|
1177
1184
|
if (this.createLogs && !bypassLogs) {
|
|
1178
1185
|
if (!options) {
|
|
1179
|
-
options = {
|
|
1186
|
+
options = { returnDocument: 'before' };
|
|
1180
1187
|
}
|
|
1181
1188
|
else {
|
|
1182
|
-
options.
|
|
1189
|
+
options.returnDocument = 'before';
|
|
1183
1190
|
}
|
|
1184
1191
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1185
1192
|
var doc = res.value;
|
|
@@ -1218,13 +1225,13 @@ var Collection = /** @class */ (function () {
|
|
|
1218
1225
|
}
|
|
1219
1226
|
else {
|
|
1220
1227
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1221
|
-
if (res.
|
|
1228
|
+
if (res.acknowledged) {
|
|
1222
1229
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1223
1230
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1224
|
-
resolve(res.
|
|
1231
|
+
resolve(res.modifiedCount);
|
|
1225
1232
|
}
|
|
1226
1233
|
else {
|
|
1227
|
-
reject(res.
|
|
1234
|
+
reject(res.acknowledged);
|
|
1228
1235
|
}
|
|
1229
1236
|
}, function (err) {
|
|
1230
1237
|
reject(err);
|
|
@@ -1314,13 +1321,13 @@ var Collection = /** @class */ (function () {
|
|
|
1314
1321
|
_a.label = 2;
|
|
1315
1322
|
case 2:
|
|
1316
1323
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateMany(filter, update, options).then(function (res) {
|
|
1317
|
-
if (res.
|
|
1324
|
+
if (res.acknowledged) {
|
|
1318
1325
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1319
1326
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1320
|
-
resolve(res.
|
|
1327
|
+
resolve(res.modifiedCount);
|
|
1321
1328
|
}
|
|
1322
1329
|
else {
|
|
1323
|
-
reject(res.
|
|
1330
|
+
reject(res.acknowledged);
|
|
1324
1331
|
}
|
|
1325
1332
|
}, function (err) { return reject(err); });
|
|
1326
1333
|
return [2 /*return*/];
|
|
@@ -1396,13 +1403,13 @@ var Collection = /** @class */ (function () {
|
|
|
1396
1403
|
}
|
|
1397
1404
|
}
|
|
1398
1405
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1399
|
-
if (res.
|
|
1406
|
+
if (res.acknowledged) {
|
|
1400
1407
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1401
1408
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1402
|
-
resolve(res.
|
|
1409
|
+
resolve(res.modifiedCount);
|
|
1403
1410
|
}
|
|
1404
1411
|
else {
|
|
1405
|
-
reject(res.
|
|
1412
|
+
reject(res.acknowledged);
|
|
1406
1413
|
}
|
|
1407
1414
|
}, function (err) { return reject(err); });
|
|
1408
1415
|
}
|
|
@@ -1445,13 +1452,13 @@ var Collection = /** @class */ (function () {
|
|
|
1445
1452
|
});
|
|
1446
1453
|
}
|
|
1447
1454
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1448
|
-
if (res.
|
|
1455
|
+
if (res.acknowledged) {
|
|
1449
1456
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1450
1457
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1451
|
-
resolve(res.
|
|
1458
|
+
resolve(res.modifiedCount);
|
|
1452
1459
|
}
|
|
1453
1460
|
else {
|
|
1454
|
-
reject(res.
|
|
1461
|
+
reject(res.acknowledged);
|
|
1455
1462
|
}
|
|
1456
1463
|
}, function (err) { return reject(err); });
|
|
1457
1464
|
}
|
|
@@ -1485,10 +1492,10 @@ var Collection = /** @class */ (function () {
|
|
|
1485
1492
|
}
|
|
1486
1493
|
if (this.createLogs && !bypassLogs) {
|
|
1487
1494
|
if (!options) {
|
|
1488
|
-
options = {
|
|
1495
|
+
options = { returnDocument: 'before' };
|
|
1489
1496
|
}
|
|
1490
1497
|
else {
|
|
1491
|
-
options.
|
|
1498
|
+
options.returnDocument = 'before';
|
|
1492
1499
|
}
|
|
1493
1500
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1494
1501
|
var doc = res.value;
|
|
@@ -1531,13 +1538,13 @@ var Collection = /** @class */ (function () {
|
|
|
1531
1538
|
}
|
|
1532
1539
|
else {
|
|
1533
1540
|
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1534
|
-
if (res.
|
|
1541
|
+
if (res.acknowledged) {
|
|
1535
1542
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1536
1543
|
index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
|
|
1537
|
-
resolve(res.
|
|
1544
|
+
resolve(res.modifiedCount);
|
|
1538
1545
|
}
|
|
1539
1546
|
else {
|
|
1540
|
-
reject(res.
|
|
1547
|
+
reject(res.acknowledged);
|
|
1541
1548
|
}
|
|
1542
1549
|
}, function (err) { return reject(err); });
|
|
1543
1550
|
}
|