This commit is contained in:
Freddy Thobhani
2020-09-27 23:02:39 +02:00
committed by GitHub
2 changed files with 23 additions and 8 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -274,16 +274,31 @@ module.exports = function(RED) {
}
else if (node.operation === "aggregate") {
msg.payload = (Array.isArray(msg.payload)) ? msg.payload : [];
coll.aggregate(msg.payload, function(err, result) {
if(msg.allowDiskUse == true){
var cursor = coll.aggregate(msg.payload, {allowDiskUse: true});
cursor.each(processCursor);
function processCursor(err, result){
if(err){
err = "custom error: " +err;
node.error(err);
}
else {
} else{
msg.payload = result;
node.send(msg);
}
}
} else{
coll.aggregate(msg.payload,function(err,result)){
if(err){
node.error(err);
} else {
msg.payload = result;
msg.send(msg);
}
});
}
}
});
}
});