mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-01 10:13:38 -04:00
MongoDB bulk get fix.
This commit is contained in:
parent
e9bd782418
commit
cb8fc7d150
2
db.js
2
db.js
@ -1479,7 +1479,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there are not results, send out a null callback
|
// If there are not results, send out a null callback
|
||||||
for (var i in obj.filePendingGets) { for (var j in obj.filePendingGets[i]) { obj.filePendingGets[i][j](err, null); } }
|
for (var i in obj.filePendingGets) { for (var j in obj.filePendingGets[i]) { obj.filePendingGets[i][j](err, []); } }
|
||||||
|
|
||||||
// Move on to process any more pending get operations
|
// Move on to process any more pending get operations
|
||||||
obj.filePendingGets = obj.filePendingGet;
|
obj.filePendingGets = obj.filePendingGet;
|
||||||
|
@ -1205,7 +1205,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
if (command.oldnodeid.length != 64) break;
|
if (command.oldnodeid.length != 64) break;
|
||||||
const oldNodeKey = 'node//' + command.oldnodeid.toLowerCase();
|
const oldNodeKey = 'node//' + command.oldnodeid.toLowerCase();
|
||||||
db.Get(oldNodeKey, function (err, nodes) {
|
db.Get(oldNodeKey, function (err, nodes) {
|
||||||
if ((nodes != null) && (nodes.length != 1)) return;
|
if ((nodes == null) || (nodes.length != 1)) return;
|
||||||
const node = nodes[0];
|
const node = nodes[0];
|
||||||
if (node.meshid == obj.dbMeshKey) {
|
if (node.meshid == obj.dbMeshKey) {
|
||||||
// Update the device name & host
|
// Update the device name & host
|
||||||
@ -1283,7 +1283,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
if ((obj.agentInfo.capabilities & 0x40) != 0) {
|
if ((obj.agentInfo.capabilities & 0x40) != 0) {
|
||||||
// Return nodeid of main agent + connection status
|
// Return nodeid of main agent + connection status
|
||||||
db.Get('da' + obj.dbNodeKey, function (err, nodes) {
|
db.Get('da' + obj.dbNodeKey, function (err, nodes) {
|
||||||
if (nodes.length == 1) {
|
if ((nodes != null) && (nodes.length == 1)) {
|
||||||
obj.realNodeKey = nodes[0].raid;
|
obj.realNodeKey = nodes[0].raid;
|
||||||
|
|
||||||
// Get agent connection state
|
// Get agent connection state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user