Added MongoDB bulk remove for added performance.

This commit is contained in:
Ylian Saint-Hilaire
2021-01-12 14:02:11 -08:00
parent a12fba0d98
commit 394a2e2878
2 changed files with 37 additions and 3 deletions

View File

@@ -3587,7 +3587,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (db.RemoveSMBIOS) { db.RemoveSMBIOS(node._id); } // Remove SMBios data
db.RemoveAllNodeEvents(node._id); // Remove all events for this node
db.removeAllPowerEventsForNode(node._id); // Remove all power events for this node
db.Get('ra' + obj.dbNodeKey, function (err, nodes) {
db.Get('ra' + node._id, function (err, nodes) {
if ((nodes != null) && (nodes.length == 1)) { db.Remove('da' + nodes[0].daid); } // Remove diagnostic agent to real agent link
db.Remove('ra' + node._id); // Remove real agent to diagnostic agent link
});