mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added MongoDbChangeStream option.
This commit is contained in:
parent
0e7c091530
commit
88b0b8601c
3 changed files with 8 additions and 7 deletions
6
db.js
6
db.js
|
@ -230,8 +230,8 @@ module.exports.CreateDB = function (parent, func) {
|
|||
});
|
||||
|
||||
// Setup the changeStream on the MongoDB main collection if possible
|
||||
try {
|
||||
obj.fileChangeStream = obj.file.watch([{ $match: { 'fullDocument.type': { $in: [ 'node', 'mesh', 'user' ] } } }], { fullDocument: 'updateLookup' });
|
||||
if (parent.args.mongodbchangestream == true) {
|
||||
obj.fileChangeStream = obj.file.watch([{ $match: { 'fullDocument.type': { $in: ['node', 'mesh', 'user'] } } }], { fullDocument: 'updateLookup' });
|
||||
obj.fileChangeStream.on('change', function (change) {
|
||||
switch (change.fullDocument.type) {
|
||||
case 'node': { dbNodeChange(change); break; } // A node has changed
|
||||
|
@ -240,7 +240,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||
}
|
||||
});
|
||||
obj.changeStream = true;
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
// Setup MongoDB events collection and indexes
|
||||
obj.eventsfile = db.collection('events'); // Collection containing all events
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue