@resolveio/server-lib 8.1.36 → 9.0.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.
- package/collections/app-status.collection.d.ts +2 -6
- package/collections/app-status.collection.js +4 -21
- package/collections/app-status.collection.js.map +1 -1
- package/collections/app-version.collection.d.ts +2 -6
- package/collections/app-version.collection.js +4 -34
- package/collections/app-version.collection.js.map +1 -1
- package/collections/counter.collection.d.ts +2 -6
- package/collections/counter.collection.js +4 -34
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.d.ts +3 -7
- package/collections/cron-job-history.collection.js +5 -34
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.d.ts +2 -6
- package/collections/cron-job.collection.js +4 -33
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.d.ts +2 -6
- package/collections/email-history.collection.js +4 -21
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.d.ts +2 -6
- package/collections/email-verified.collection.js +5 -22
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.d.ts +2 -6
- package/collections/file.collection.js +4 -26
- package/collections/file.collection.js.map +1 -1
- package/collections/flag.collection.d.ts +2 -6
- package/collections/flag.collection.js +4 -21
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.d.ts +2 -6
- package/collections/log-method-latency.collection.js +7 -22
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.d.ts +2 -6
- package/collections/log-subscription.collection.js +9 -24
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log.collection.d.ts +2 -6
- package/collections/log.collection.js +9 -25
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.d.ts +2 -6
- package/collections/logged-in-users.collection.js +5 -32
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/method-call.collection.d.ts +2 -5
- package/collections/method-call.collection.js +5 -11
- package/collections/method-call.collection.js.map +1 -1
- package/collections/method-response.collection.d.ts +2 -5
- package/collections/method-response.collection.js +5 -11
- package/collections/method-response.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.d.ts +2 -6
- package/collections/monitor-cpu.collection.js +9 -26
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-https-inbound.collection.d.ts +2 -6
- package/collections/monitor-https-inbound.collection.js +9 -26
- package/collections/monitor-https-inbound.collection.js.map +1 -1
- package/collections/monitor-https-outbound.collection.d.ts +2 -6
- package/collections/monitor-https-outbound.collection.js +11 -28
- package/collections/monitor-https-outbound.collection.js.map +1 -1
- package/collections/monitor-memory.collection.d.ts +2 -6
- package/collections/monitor-memory.collection.js +8 -25
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.d.ts +2 -6
- package/collections/monitor-mongo.collection.js +8 -25
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.d.ts +2 -6
- package/collections/notification.collection.js +4 -21
- package/collections/notification.collection.js.map +1 -1
- package/collections/queue-flag.collection.d.ts +2 -6
- package/collections/queue-flag.collection.js +5 -22
- package/collections/queue-flag.collection.js.map +1 -1
- package/collections/queue-method.collection.d.ts +2 -6
- package/collections/queue-method.collection.js +6 -77
- package/collections/queue-method.collection.js.map +1 -1
- package/collections/queue-response.collection.d.ts +2 -6
- package/collections/queue-response.collection.js +5 -34
- package/collections/queue-response.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.d.ts +2 -6
- package/collections/report-builder-dashboard-builder.collection.js +6 -35
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.d.ts +2 -6
- package/collections/report-builder-library.collection.js +7 -36
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.d.ts +2 -6
- package/collections/report-builder-report.collection.js +7 -36
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.d.ts +3 -6
- package/collections/user-group.collection.js +5 -38
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.d.ts +2 -6
- package/collections/user-guide.collection.js +4 -26
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.d.ts +3 -6
- package/collections/user.collection.js +36 -62
- package/collections/user.collection.js.map +1 -1
- package/fixtures/cron-jobs.js +5 -5
- package/fixtures/cron-jobs.js.map +1 -1
- package/fixtures/init.js +2 -2
- package/fixtures/init.js.map +1 -1
- package/http/auth.js +201 -185
- package/http/auth.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +5 -6
- package/index.js.map +1 -1
- package/managers/cron.manager.js +6 -6
- package/managers/cron.manager.js.map +1 -1
- package/managers/method.manager.js +10 -10
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.d.ts +102 -0
- package/managers/mongo.manager.js +514 -0
- package/managers/mongo.manager.js.map +1 -0
- package/managers/monitor.manager.js +6 -6
- package/managers/monitor.manager.js.map +1 -1
- package/managers/queue-method.manager.js +14 -14
- package/managers/queue-method.manager.js.map +1 -1
- package/managers/subscription.manager.js +9 -7
- package/managers/subscription.manager.js.map +1 -1
- package/methods/accounts.js +23 -21
- package/methods/accounts.js.map +1 -1
- package/methods/aws.js +7 -7
- package/methods/aws.js.map +1 -1
- package/methods/collections.js +112 -119
- package/methods/collections.js.map +1 -1
- package/methods/counters.js +5 -5
- package/methods/counters.js.map +1 -1
- package/methods/cron-jobs.js +2 -2
- package/methods/cron-jobs.js.map +1 -1
- package/methods/logs.js +8 -8
- package/methods/logs.js.map +1 -1
- package/methods/monitor.js +6 -6
- package/methods/monitor.js.map +1 -1
- package/methods/pdf.js +5 -5
- package/methods/pdf.js.map +1 -1
- package/methods/report-builder.js +2 -2
- package/methods/report-builder.js.map +1 -1
- package/models/report-builder.model.d.ts +1 -2
- package/models/report-builder.model.js.map +1 -1
- package/models/user.model.d.ts +9 -7
- package/models/user.model.js.map +1 -1
- package/package.json +26 -27
- package/public_api.js +1 -1
- package/publications/app-status.js +1 -1
- package/publications/app-status.js.map +1 -1
- package/publications/app-version.js +1 -1
- package/publications/app-version.js.map +1 -1
- package/publications/cron-jobs.js +2 -2
- package/publications/cron-jobs.js.map +1 -1
- package/publications/files.js +3 -3
- package/publications/files.js.map +1 -1
- package/publications/flags.js +1 -1
- package/publications/flags.js.map +1 -1
- package/publications/logs.js +3 -3
- package/publications/logs.js.map +1 -1
- package/publications/method-calls.js +1 -1
- package/publications/method-calls.js.map +1 -1
- package/publications/method-responses.js +1 -1
- package/publications/method-responses.js.map +1 -1
- package/publications/notifications.js +1 -1
- package/publications/notifications.js.map +1 -1
- package/publications/report-builder-dashboard-builders.js +2 -2
- package/publications/report-builder-dashboard-builders.js.map +1 -1
- package/publications/report-builder-libraries.js +3 -3
- package/publications/report-builder-libraries.js.map +1 -1
- package/publications/report-builder-reports.js +4 -4
- package/publications/report-builder-reports.js.map +1 -1
- package/publications/super-admin.js +1 -1
- package/publications/super-admin.js.map +1 -1
- package/publications/user-groups.js +1 -1
- package/publications/user-groups.js.map +1 -1
- package/publications/user-guides.js +1 -1
- package/publications/user-guides.js.map +1 -1
- package/server-app.d.ts +4 -1
- package/server-app.js +19 -28
- package/server-app.js.map +1 -1
- package/util/common.d.ts +2 -3
- package/util/common.js +16 -21
- package/util/common.js.map +1 -1
- package/util/schema-report-builder.js +5 -5
- package/util/schema-report-builder.js.map +1 -1
- package/managers/database.manager.d.ts +0 -6
- package/managers/database.manager.js +0 -15
- package/managers/database.manager.js.map +0 -1
package/methods/collections.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadCollectionMethods = void 0;
|
|
4
|
-
var mongoose_1 = require("mongoose");
|
|
5
4
|
var common_1 = require("../util/common");
|
|
6
5
|
var simpl_schema_1 = require("simpl-schema");
|
|
7
6
|
var pagination_model_1 = require("../models/pagination.model");
|
|
8
7
|
var log_collection_1 = require("../collections/log.collection");
|
|
9
8
|
var index_1 = require("../index");
|
|
9
|
+
var mongo_manager_1 = require("../managers/mongo.manager");
|
|
10
10
|
function loadCollectionMethods(methodManager) {
|
|
11
11
|
methodManager.methods({
|
|
12
12
|
// Query database for any collection and query
|
|
@@ -22,7 +22,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
22
22
|
}
|
|
23
23
|
}),
|
|
24
24
|
function: function (collection, query) {
|
|
25
|
-
return index_1.ResolveIOServer.
|
|
25
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).findOne(query);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
find: {
|
|
@@ -43,7 +43,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
43
43
|
}),
|
|
44
44
|
function: function (collection, query, sortQuery) {
|
|
45
45
|
if (sortQuery === void 0) { sortQuery = {}; }
|
|
46
|
-
return index_1.ResolveIOServer.
|
|
46
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).find(query, { sort: sortQuery });
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
findWithOptions: {
|
|
@@ -61,7 +61,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
61
61
|
}
|
|
62
62
|
}),
|
|
63
63
|
function: function (collection, query, options) {
|
|
64
|
-
return index_1.ResolveIOServer.
|
|
64
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).find(query, { projection: options.fields, sort: options.sort, limit: options.limit, skip: options.skip });
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
// Insert 1 document
|
|
@@ -82,7 +82,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
82
82
|
return new Promise(function (resolve, reject) {
|
|
83
83
|
var schemaErrors = null;
|
|
84
84
|
try {
|
|
85
|
-
index_1.ResolveIOServer.
|
|
85
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(document);
|
|
86
86
|
}
|
|
87
87
|
catch (errors) {
|
|
88
88
|
schemaErrors = errors;
|
|
@@ -95,7 +95,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
95
95
|
else {
|
|
96
96
|
if (common_1.getBinarySize(JSON.stringify(document)) < 200000) {
|
|
97
97
|
log_collection_1.Logs.create({
|
|
98
|
-
_id:
|
|
98
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
99
99
|
date: new Date(),
|
|
100
100
|
type: 'info',
|
|
101
101
|
title: 'Insert Document',
|
|
@@ -108,7 +108,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
log_collection_1.Logs.create({
|
|
111
|
-
_id:
|
|
111
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
112
112
|
date: new Date(),
|
|
113
113
|
type: 'info',
|
|
114
114
|
title: 'Insert Document',
|
|
@@ -119,10 +119,10 @@ function loadCollectionMethods(methodManager) {
|
|
|
119
119
|
messageId: ''
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
var id_1 =
|
|
122
|
+
var id_1 = mongo_manager_1.objectIdHexString();
|
|
123
123
|
document['_id'] = id_1;
|
|
124
124
|
document['__v'] = 0;
|
|
125
|
-
index_1.ResolveIOServer.
|
|
125
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).insertOne(document).then(function () { return resolve(id_1); }, function (err) { return reject(err); });
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}
|
|
@@ -152,7 +152,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
152
152
|
promises.push(new Promise(function (resolve, reject) {
|
|
153
153
|
var schemaErrors = null;
|
|
154
154
|
try {
|
|
155
|
-
index_1.ResolveIOServer.
|
|
155
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(document_1);
|
|
156
156
|
}
|
|
157
157
|
catch (errors) {
|
|
158
158
|
schemaErrors = errors;
|
|
@@ -165,7 +165,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
165
165
|
else {
|
|
166
166
|
if (common_1.getBinarySize(JSON.stringify(document_1)) < 200000) {
|
|
167
167
|
log_collection_1.Logs.create({
|
|
168
|
-
_id:
|
|
168
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
169
169
|
date: new Date(),
|
|
170
170
|
type: 'info',
|
|
171
171
|
title: 'Insert Document',
|
|
@@ -178,7 +178,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
180
|
log_collection_1.Logs.create({
|
|
181
|
-
_id:
|
|
181
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
182
182
|
date: new Date(),
|
|
183
183
|
type: 'info',
|
|
184
184
|
title: 'Insert Document',
|
|
@@ -189,10 +189,10 @@ function loadCollectionMethods(methodManager) {
|
|
|
189
189
|
messageId: ''
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
var id_2 =
|
|
192
|
+
var id_2 = mongo_manager_1.objectIdHexString();
|
|
193
193
|
document_1['_id'] = id_2;
|
|
194
194
|
document_1['__v'] = 0;
|
|
195
|
-
index_1.ResolveIOServer.
|
|
195
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).insertOne(document_1).then(function () { return resolve(id_2); }, function (err) { return reject(err); });
|
|
196
196
|
}
|
|
197
197
|
}));
|
|
198
198
|
};
|
|
@@ -220,7 +220,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
220
220
|
function: function (collection, f_document) {
|
|
221
221
|
var _this = this;
|
|
222
222
|
return new Promise(function (resolve, reject) {
|
|
223
|
-
index_1.ResolveIOServer.
|
|
223
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).findOne({ _id: f_document['_id'] }).then(function (currDoc) {
|
|
224
224
|
if (currDoc) {
|
|
225
225
|
if (currDoc.__v === f_document['__v']) {
|
|
226
226
|
var versionDoc = common_1.deepCopy(currDoc);
|
|
@@ -230,7 +230,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
230
230
|
};
|
|
231
231
|
var schemaErrors = null;
|
|
232
232
|
try {
|
|
233
|
-
index_1.ResolveIOServer.
|
|
233
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(f_document);
|
|
234
234
|
}
|
|
235
235
|
catch (errors) {
|
|
236
236
|
schemaErrors = errors;
|
|
@@ -242,16 +242,16 @@ function loadCollectionMethods(methodManager) {
|
|
|
242
242
|
}
|
|
243
243
|
else {
|
|
244
244
|
var updates_1 = common_1.getMongoUpdates(currDoc, f_document, true);
|
|
245
|
-
index_1.ResolveIOServer.
|
|
246
|
-
index_1.ResolveIOServer.
|
|
245
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc).then(function (doc) {
|
|
246
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
247
247
|
$and: [
|
|
248
248
|
{ '_id._id': currDoc._id },
|
|
249
249
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
250
250
|
]
|
|
251
|
-
}).
|
|
251
|
+
}).then(function () {
|
|
252
252
|
if (updates_1) {
|
|
253
|
-
index_1.ResolveIOServer.
|
|
254
|
-
resolve(res.nModified);
|
|
253
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: f_document['_id'] }, updates_1).then(function (res) {
|
|
254
|
+
resolve(res.result.nModified);
|
|
255
255
|
}, function (err) { return reject(err); });
|
|
256
256
|
}
|
|
257
257
|
else {
|
|
@@ -262,15 +262,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
262
262
|
});
|
|
263
263
|
}, function (err) {
|
|
264
264
|
console.log(err);
|
|
265
|
-
index_1.ResolveIOServer.
|
|
265
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
266
266
|
$and: [
|
|
267
267
|
{ '_id._id': currDoc._id },
|
|
268
268
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
269
269
|
]
|
|
270
|
-
}).
|
|
270
|
+
}).then(function () {
|
|
271
271
|
if (updates_1) {
|
|
272
|
-
index_1.ResolveIOServer.
|
|
273
|
-
resolve(res.nModified);
|
|
272
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: f_document['_id'] }, updates_1).then(function (res) {
|
|
273
|
+
resolve(res.result.nModified);
|
|
274
274
|
}, function (err) { return reject(err); });
|
|
275
275
|
}
|
|
276
276
|
else {
|
|
@@ -282,7 +282,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
282
282
|
});
|
|
283
283
|
if (common_1.getBinarySize(JSON.stringify(f_document)) < 200000) {
|
|
284
284
|
log_collection_1.Logs.create({
|
|
285
|
-
_id:
|
|
285
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
286
286
|
date: new Date(),
|
|
287
287
|
type: 'info',
|
|
288
288
|
title: 'Update Document',
|
|
@@ -295,7 +295,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
295
295
|
}
|
|
296
296
|
else {
|
|
297
297
|
log_collection_1.Logs.create({
|
|
298
|
-
_id:
|
|
298
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
299
299
|
date: new Date(),
|
|
300
300
|
type: 'info',
|
|
301
301
|
title: 'Update Document',
|
|
@@ -310,12 +310,12 @@ function loadCollectionMethods(methodManager) {
|
|
|
310
310
|
}
|
|
311
311
|
else {
|
|
312
312
|
console.log('invalid version - ' + collection, currDoc.__v, f_document['__v']);
|
|
313
|
-
index_1.ResolveIOServer.
|
|
313
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').findOne({
|
|
314
314
|
$and: [
|
|
315
315
|
{ '_id._id': currDoc._id },
|
|
316
316
|
{ '_id.__v': f_document['__v'] }
|
|
317
317
|
]
|
|
318
|
-
}).
|
|
318
|
+
}).then(function (oldDoc) {
|
|
319
319
|
var newCurrDocId = currDoc._id;
|
|
320
320
|
if (oldDoc) {
|
|
321
321
|
var versionDoc_1 = common_1.deepCopy(currDoc);
|
|
@@ -327,15 +327,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
327
327
|
updatedDoc._id = newCurrDocId;
|
|
328
328
|
updatedDoc.__v++;
|
|
329
329
|
updatedDoc.updatedAt = new Date();
|
|
330
|
-
index_1.ResolveIOServer.
|
|
331
|
-
index_1.ResolveIOServer.
|
|
332
|
-
index_1.ResolveIOServer.
|
|
330
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).then(function (res) {
|
|
331
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc_1).then(function (doc) {
|
|
332
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
333
333
|
$and: [
|
|
334
334
|
{ '_id._id': versionDoc_1._id._id },
|
|
335
335
|
{ '_id.__v': { $lte: versionDoc_1._id.__v - 4 } }
|
|
336
336
|
]
|
|
337
|
-
}).
|
|
338
|
-
resolve(res.nModified);
|
|
337
|
+
}).then(function () {
|
|
338
|
+
resolve(res.result.nModified);
|
|
339
339
|
}, function (err) {
|
|
340
340
|
console.log(err);
|
|
341
341
|
});
|
|
@@ -347,12 +347,14 @@ function loadCollectionMethods(methodManager) {
|
|
|
347
347
|
else {
|
|
348
348
|
reject('Invalid Version And Could Not Find History - DB: ' + currDoc.__v + ', Trying to update with :' + f_document['__v']);
|
|
349
349
|
}
|
|
350
|
-
});
|
|
350
|
+
}, function (errOldDoc) { });
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
else {
|
|
354
354
|
reject('No Document');
|
|
355
355
|
}
|
|
356
|
+
}, function (errDoc) {
|
|
357
|
+
reject('No Document');
|
|
356
358
|
});
|
|
357
359
|
});
|
|
358
360
|
}
|
|
@@ -383,7 +385,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
383
385
|
function: function (collection, doc_id, updateParams, doc__v) {
|
|
384
386
|
var _this = this;
|
|
385
387
|
return new Promise(function (resolve, reject) {
|
|
386
|
-
index_1.ResolveIOServer.
|
|
388
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).findOne({ _id: doc_id }).then(function (currDoc) {
|
|
387
389
|
if (currDoc) {
|
|
388
390
|
var modifiedDoc_1 = common_1.deepCopy(currDoc);
|
|
389
391
|
updateParams.forEach(function (data) {
|
|
@@ -397,7 +399,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
397
399
|
};
|
|
398
400
|
var schemaErrors = null;
|
|
399
401
|
try {
|
|
400
|
-
index_1.ResolveIOServer.
|
|
402
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(modifiedDoc_1);
|
|
401
403
|
}
|
|
402
404
|
catch (errors) {
|
|
403
405
|
schemaErrors = errors;
|
|
@@ -409,16 +411,16 @@ function loadCollectionMethods(methodManager) {
|
|
|
409
411
|
}
|
|
410
412
|
else {
|
|
411
413
|
var updates_2 = common_1.getMongoUpdates(currDoc, modifiedDoc_1, true);
|
|
412
|
-
index_1.ResolveIOServer.
|
|
413
|
-
index_1.ResolveIOServer.
|
|
414
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc).then(function (doc) {
|
|
415
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
414
416
|
$and: [
|
|
415
417
|
{ '_id._id': currDoc._id },
|
|
416
418
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
417
419
|
]
|
|
418
|
-
}).
|
|
420
|
+
}).then(function () {
|
|
419
421
|
if (updates_2) {
|
|
420
|
-
index_1.ResolveIOServer.
|
|
421
|
-
resolve(res.ok);
|
|
422
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: modifiedDoc_1._id }, updates_2).then(function (res) {
|
|
423
|
+
resolve(res.result.ok);
|
|
422
424
|
}, function (err) { return reject(err); });
|
|
423
425
|
}
|
|
424
426
|
else {
|
|
@@ -429,15 +431,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
429
431
|
});
|
|
430
432
|
}, function (err) {
|
|
431
433
|
console.log(err);
|
|
432
|
-
index_1.ResolveIOServer.
|
|
434
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
433
435
|
$and: [
|
|
434
436
|
{ '_id._id': currDoc._id },
|
|
435
437
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
436
438
|
]
|
|
437
|
-
}).
|
|
439
|
+
}).then(function () {
|
|
438
440
|
if (updates_2) {
|
|
439
|
-
index_1.ResolveIOServer.
|
|
440
|
-
resolve(res.
|
|
441
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: modifiedDoc_1._id }, updates_2).then(function (res) {
|
|
442
|
+
resolve(res.result.n);
|
|
441
443
|
}, function (err) { return reject(err); });
|
|
442
444
|
}
|
|
443
445
|
else {
|
|
@@ -449,7 +451,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
449
451
|
});
|
|
450
452
|
if (common_1.getBinarySize(JSON.stringify(updateParams)) < 200000) {
|
|
451
453
|
log_collection_1.Logs.create({
|
|
452
|
-
_id:
|
|
454
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
453
455
|
date: new Date(),
|
|
454
456
|
type: 'info',
|
|
455
457
|
title: 'Update Document Props',
|
|
@@ -462,7 +464,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
462
464
|
}
|
|
463
465
|
else {
|
|
464
466
|
log_collection_1.Logs.create({
|
|
465
|
-
_id:
|
|
467
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
466
468
|
date: new Date(),
|
|
467
469
|
type: 'info',
|
|
468
470
|
title: 'Update Document Props',
|
|
@@ -477,12 +479,12 @@ function loadCollectionMethods(methodManager) {
|
|
|
477
479
|
}
|
|
478
480
|
else {
|
|
479
481
|
console.log(new Date(), 'invalid version - ' + collection, currDoc.__v, doc__v);
|
|
480
|
-
index_1.ResolveIOServer.
|
|
482
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').findOne({
|
|
481
483
|
$and: [
|
|
482
484
|
{ '_id._id': currDoc._id },
|
|
483
485
|
{ '_id.__v': doc__v }
|
|
484
486
|
]
|
|
485
|
-
}).
|
|
487
|
+
}).then(function (oldDoc) {
|
|
486
488
|
var newCurrDocId = currDoc._id;
|
|
487
489
|
if (oldDoc) {
|
|
488
490
|
var versionDoc_2 = common_1.deepCopy(currDoc);
|
|
@@ -494,15 +496,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
494
496
|
updatedDoc._id = newCurrDocId;
|
|
495
497
|
updatedDoc.__v++;
|
|
496
498
|
updatedDoc.updatedAt = new Date();
|
|
497
|
-
index_1.ResolveIOServer.
|
|
498
|
-
index_1.ResolveIOServer.
|
|
499
|
-
index_1.ResolveIOServer.
|
|
499
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).then(function (res) {
|
|
500
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc_2).then(function (doc) {
|
|
501
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
500
502
|
$and: [
|
|
501
503
|
{ '_id._id': versionDoc_2._id._id },
|
|
502
504
|
{ '_id.__v': { $lte: versionDoc_2._id.__v - 4 } }
|
|
503
505
|
]
|
|
504
|
-
}).
|
|
505
|
-
resolve(res.nModified);
|
|
506
|
+
}).then(function () {
|
|
507
|
+
resolve(res.result.nModified);
|
|
506
508
|
}, function (err) {
|
|
507
509
|
console.log(err);
|
|
508
510
|
});
|
|
@@ -514,13 +516,13 @@ function loadCollectionMethods(methodManager) {
|
|
|
514
516
|
else {
|
|
515
517
|
reject('Invalid Version And Could Not Find History Props - DB: ' + currDoc.__v + ', Trying to update with :' + doc__v);
|
|
516
518
|
}
|
|
517
|
-
});
|
|
519
|
+
}, function () { });
|
|
518
520
|
}
|
|
519
521
|
}
|
|
520
522
|
else {
|
|
521
523
|
reject('No Document');
|
|
522
524
|
}
|
|
523
|
-
});
|
|
525
|
+
}, function () { });
|
|
524
526
|
});
|
|
525
527
|
}
|
|
526
528
|
},
|
|
@@ -541,7 +543,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
541
543
|
function: function (collection, f_document, f_oldDocument) {
|
|
542
544
|
var _this = this;
|
|
543
545
|
return new Promise(function (resolve, reject) {
|
|
544
|
-
index_1.ResolveIOServer.
|
|
546
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).findOne({ _id: f_document['_id'] }).then(function (currDoc) {
|
|
545
547
|
if (currDoc) {
|
|
546
548
|
if (currDoc.__v === f_document['__v']) {
|
|
547
549
|
var versionDoc = common_1.deepCopy(currDoc);
|
|
@@ -551,7 +553,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
551
553
|
};
|
|
552
554
|
var schemaErrors = null;
|
|
553
555
|
try {
|
|
554
|
-
index_1.ResolveIOServer.
|
|
556
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(f_document);
|
|
555
557
|
}
|
|
556
558
|
catch (errors) {
|
|
557
559
|
schemaErrors = errors;
|
|
@@ -563,16 +565,16 @@ function loadCollectionMethods(methodManager) {
|
|
|
563
565
|
}
|
|
564
566
|
else {
|
|
565
567
|
var updates_3 = common_1.getMongoUpdates(currDoc, f_document, true);
|
|
566
|
-
index_1.ResolveIOServer.
|
|
567
|
-
index_1.ResolveIOServer.
|
|
568
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc).then(function (doc) {
|
|
569
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
568
570
|
$and: [
|
|
569
571
|
{ '_id._id': currDoc._id },
|
|
570
572
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
571
573
|
]
|
|
572
|
-
}).
|
|
574
|
+
}).then(function () {
|
|
573
575
|
if (updates_3) {
|
|
574
|
-
index_1.ResolveIOServer.
|
|
575
|
-
resolve(res.nModified);
|
|
576
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: f_document['_id'] }, updates_3).then(function (res) {
|
|
577
|
+
resolve(res.result.nModified);
|
|
576
578
|
}, function (err) { return reject(err); });
|
|
577
579
|
}
|
|
578
580
|
else {
|
|
@@ -583,15 +585,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
583
585
|
});
|
|
584
586
|
}, function (err) {
|
|
585
587
|
console.log(err);
|
|
586
|
-
index_1.ResolveIOServer.
|
|
588
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
587
589
|
$and: [
|
|
588
590
|
{ '_id._id': currDoc._id },
|
|
589
591
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
590
592
|
]
|
|
591
|
-
}).
|
|
593
|
+
}).then(function () {
|
|
592
594
|
if (updates_3) {
|
|
593
|
-
index_1.ResolveIOServer.
|
|
594
|
-
resolve(res.nModified);
|
|
595
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: f_document['_id'] }, updates_3).then(function (res) {
|
|
596
|
+
resolve(res.result.nModified);
|
|
595
597
|
}, function (err) { return reject(err); });
|
|
596
598
|
}
|
|
597
599
|
else {
|
|
@@ -603,7 +605,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
603
605
|
});
|
|
604
606
|
if (common_1.getBinarySize(JSON.stringify(f_document)) < 200000) {
|
|
605
607
|
log_collection_1.Logs.create({
|
|
606
|
-
_id:
|
|
608
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
607
609
|
date: new Date(),
|
|
608
610
|
type: 'info',
|
|
609
611
|
title: 'Update Document',
|
|
@@ -616,7 +618,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
616
618
|
}
|
|
617
619
|
else {
|
|
618
620
|
log_collection_1.Logs.create({
|
|
619
|
-
_id:
|
|
621
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
620
622
|
date: new Date(),
|
|
621
623
|
type: 'info',
|
|
622
624
|
title: 'Update Document',
|
|
@@ -642,15 +644,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
642
644
|
updatedDoc._id = newCurrDocId;
|
|
643
645
|
updatedDoc.__v++;
|
|
644
646
|
updatedDoc.updatedAt = new Date();
|
|
645
|
-
index_1.ResolveIOServer.
|
|
646
|
-
index_1.ResolveIOServer.
|
|
647
|
-
index_1.ResolveIOServer.
|
|
647
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).then(function (res) {
|
|
648
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc_3).then(function (doc) {
|
|
649
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
648
650
|
$and: [
|
|
649
651
|
{ '_id._id': versionDoc_3._id._id },
|
|
650
652
|
{ '_id.__v': { $lte: versionDoc_3._id.__v - 4 } }
|
|
651
653
|
]
|
|
652
|
-
}).
|
|
653
|
-
resolve(res.nModified);
|
|
654
|
+
}).then(function () {
|
|
655
|
+
resolve(res.result.nModified);
|
|
654
656
|
}, function (err) {
|
|
655
657
|
console.log(err);
|
|
656
658
|
});
|
|
@@ -667,7 +669,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
667
669
|
else {
|
|
668
670
|
reject('No Document');
|
|
669
671
|
}
|
|
670
|
-
});
|
|
672
|
+
}, function () { });
|
|
671
673
|
});
|
|
672
674
|
}
|
|
673
675
|
},
|
|
@@ -701,7 +703,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
701
703
|
function: function (collection, doc_id, updateParams, doc__v, f_oldDocument) {
|
|
702
704
|
var _this = this;
|
|
703
705
|
return new Promise(function (resolve, reject) {
|
|
704
|
-
index_1.ResolveIOServer.
|
|
706
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).findOne({ _id: doc_id }).then(function (currDoc) {
|
|
705
707
|
if (currDoc) {
|
|
706
708
|
var modifiedDoc_2 = common_1.deepCopy(currDoc);
|
|
707
709
|
updateParams.forEach(function (data) {
|
|
@@ -715,7 +717,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
715
717
|
};
|
|
716
718
|
var schemaErrors = null;
|
|
717
719
|
try {
|
|
718
|
-
index_1.ResolveIOServer.
|
|
720
|
+
return index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)['simplschema'].validate(modifiedDoc_2);
|
|
719
721
|
}
|
|
720
722
|
catch (errors) {
|
|
721
723
|
schemaErrors = errors;
|
|
@@ -727,16 +729,16 @@ function loadCollectionMethods(methodManager) {
|
|
|
727
729
|
}
|
|
728
730
|
else {
|
|
729
731
|
var updates_4 = common_1.getMongoUpdates(currDoc, modifiedDoc_2, true);
|
|
730
|
-
index_1.ResolveIOServer.
|
|
731
|
-
index_1.ResolveIOServer.
|
|
732
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc).then(function (doc) {
|
|
733
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
732
734
|
$and: [
|
|
733
735
|
{ '_id._id': currDoc._id },
|
|
734
736
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
735
737
|
]
|
|
736
|
-
}).
|
|
738
|
+
}).then(function () {
|
|
737
739
|
if (updates_4) {
|
|
738
|
-
index_1.ResolveIOServer.
|
|
739
|
-
resolve(res.ok);
|
|
740
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: modifiedDoc_2._id }, updates_4).then(function (res) {
|
|
741
|
+
resolve(res.result.ok);
|
|
740
742
|
}, function (err) { return reject(err); });
|
|
741
743
|
}
|
|
742
744
|
else {
|
|
@@ -747,15 +749,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
747
749
|
});
|
|
748
750
|
}, function (err) {
|
|
749
751
|
console.log(err);
|
|
750
|
-
index_1.ResolveIOServer.
|
|
752
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
751
753
|
$and: [
|
|
752
754
|
{ '_id._id': currDoc._id },
|
|
753
755
|
{ '_id.__v': { $lte: currDoc.__v - 4 } }
|
|
754
756
|
]
|
|
755
|
-
}).
|
|
757
|
+
}).then(function () {
|
|
756
758
|
if (updates_4) {
|
|
757
|
-
index_1.ResolveIOServer.
|
|
758
|
-
resolve(res.ok);
|
|
759
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).updateOne({ _id: modifiedDoc_2._id }, updates_4).then(function (res) {
|
|
760
|
+
resolve(res.result.ok);
|
|
759
761
|
}, function (err) { return reject(err); });
|
|
760
762
|
}
|
|
761
763
|
else {
|
|
@@ -767,7 +769,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
767
769
|
});
|
|
768
770
|
if (common_1.getBinarySize(JSON.stringify(updateParams)) < 200000) {
|
|
769
771
|
log_collection_1.Logs.create({
|
|
770
|
-
_id:
|
|
772
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
771
773
|
date: new Date(),
|
|
772
774
|
type: 'info',
|
|
773
775
|
title: 'Update Document Props',
|
|
@@ -780,7 +782,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
780
782
|
}
|
|
781
783
|
else {
|
|
782
784
|
log_collection_1.Logs.create({
|
|
783
|
-
_id:
|
|
785
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
784
786
|
date: new Date(),
|
|
785
787
|
type: 'info',
|
|
786
788
|
title: 'Update Document Props',
|
|
@@ -806,15 +808,15 @@ function loadCollectionMethods(methodManager) {
|
|
|
806
808
|
updatedDoc._id = newCurrDocId;
|
|
807
809
|
updatedDoc.__v++;
|
|
808
810
|
updatedDoc.updatedAt = new Date();
|
|
809
|
-
index_1.ResolveIOServer.
|
|
810
|
-
index_1.ResolveIOServer.
|
|
811
|
-
index_1.ResolveIOServer.
|
|
811
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).then(function (res) {
|
|
812
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').create(versionDoc_4).then(function (doc) {
|
|
813
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection + '.versions').deleteMany({
|
|
812
814
|
$and: [
|
|
813
815
|
{ '_id._id': versionDoc_4._id._id },
|
|
814
816
|
{ '_id.__v': { $lte: versionDoc_4._id.__v - 4 } }
|
|
815
817
|
]
|
|
816
|
-
}).
|
|
817
|
-
resolve(res.nModified);
|
|
818
|
+
}).then(function () {
|
|
819
|
+
resolve(res.result.nModified);
|
|
818
820
|
}, function (err) {
|
|
819
821
|
console.log(err);
|
|
820
822
|
});
|
|
@@ -831,7 +833,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
831
833
|
else {
|
|
832
834
|
reject('No Document');
|
|
833
835
|
}
|
|
834
|
-
});
|
|
836
|
+
}, function () { });
|
|
835
837
|
});
|
|
836
838
|
}
|
|
837
839
|
},
|
|
@@ -852,7 +854,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
852
854
|
var _this = this;
|
|
853
855
|
return new Promise(function (resolve, reject) {
|
|
854
856
|
log_collection_1.Logs.create({
|
|
855
|
-
_id:
|
|
857
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
856
858
|
date: new Date(),
|
|
857
859
|
type: 'info',
|
|
858
860
|
title: 'Remove Document',
|
|
@@ -862,13 +864,10 @@ function loadCollectionMethods(methodManager) {
|
|
|
862
864
|
user: _this.user,
|
|
863
865
|
messageId: ''
|
|
864
866
|
});
|
|
865
|
-
index_1.ResolveIOServer.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
else {
|
|
870
|
-
resolve(res.ok);
|
|
871
|
-
}
|
|
867
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteOne({ _id: doc_id }).then(function (res) {
|
|
868
|
+
resolve(res.result.ok);
|
|
869
|
+
}, function (err) {
|
|
870
|
+
reject(err);
|
|
872
871
|
});
|
|
873
872
|
});
|
|
874
873
|
}
|
|
@@ -887,7 +886,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
887
886
|
var _this = this;
|
|
888
887
|
return new Promise(function (resolve, reject) {
|
|
889
888
|
log_collection_1.Logs.create({
|
|
890
|
-
_id:
|
|
889
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
891
890
|
date: new Date(),
|
|
892
891
|
type: 'info',
|
|
893
892
|
title: 'Remove Document (Query)',
|
|
@@ -897,13 +896,10 @@ function loadCollectionMethods(methodManager) {
|
|
|
897
896
|
user: _this.user,
|
|
898
897
|
messageId: ''
|
|
899
898
|
});
|
|
900
|
-
index_1.ResolveIOServer.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
else {
|
|
905
|
-
resolve(res.ok);
|
|
906
|
-
}
|
|
899
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteOne(query).then(function (res) {
|
|
900
|
+
resolve(res.result.ok);
|
|
901
|
+
}, function (err) {
|
|
902
|
+
reject(err);
|
|
907
903
|
});
|
|
908
904
|
});
|
|
909
905
|
}
|
|
@@ -922,7 +918,7 @@ function loadCollectionMethods(methodManager) {
|
|
|
922
918
|
var _this = this;
|
|
923
919
|
return new Promise(function (resolve, reject) {
|
|
924
920
|
log_collection_1.Logs.create({
|
|
925
|
-
_id:
|
|
921
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
926
922
|
date: new Date(),
|
|
927
923
|
type: 'info',
|
|
928
924
|
title: 'Remove Documents (Query)',
|
|
@@ -932,13 +928,10 @@ function loadCollectionMethods(methodManager) {
|
|
|
932
928
|
user: _this.user,
|
|
933
929
|
messageId: ''
|
|
934
930
|
});
|
|
935
|
-
index_1.ResolveIOServer.
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
else {
|
|
940
|
-
resolve(res.ok);
|
|
941
|
-
}
|
|
931
|
+
index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteMany(query).then(function (res) {
|
|
932
|
+
resolve(res.result.ok);
|
|
933
|
+
}, function (err) {
|
|
934
|
+
reject(err);
|
|
942
935
|
});
|
|
943
936
|
});
|
|
944
937
|
}
|