mongodb - dereference aggregateCursor (#696)

new node.js client library moved  aggregate response  - using toArray to  return result-set in msg.payload #693
This commit is contained in:
Ross Cruickshank 2020-10-05 09:28:39 +01:00 committed by GitHub
parent aa45796a98
commit 4ae0818a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -279,8 +279,16 @@ module.exports = function(RED) {
node.error(err);
}
else {
msg.payload = result;
node.send(msg);
cursor.toArray(function(cursorError, cursorDocs) {
console.log(cursorDocs);
if (cursorError) {
node.error(cursorError);
}
else {
msg.payload = cursorDocs;
node.send(msg);
}
});
}
});
}