1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

mongodb cusor handling #714 (#715)

match cursor handling with parameter
This commit is contained in:
Ross Cruickshank 2020-11-16 15:43:53 +00:00 committed by GitHub
parent 9e7a8d5764
commit 8363a774e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,13 +274,13 @@ module.exports = function(RED) {
} }
else if (node.operation === "aggregate") { else if (node.operation === "aggregate") {
msg.payload = (Array.isArray(msg.payload)) ? msg.payload : []; msg.payload = (Array.isArray(msg.payload)) ? msg.payload : [];
coll.aggregate(msg.payload, function(err, result) { coll.aggregate(msg.payload, function(err, cursor) {
if (err) { if (err) {
node.error(err); node.error(err);
} }
else { else {
cursor.toArray(function(cursorError, cursorDocs) { cursor.toArray(function(cursorError, cursorDocs) {
console.log(cursorDocs); //console.log(cursorDocs);
if (cursorError) { if (cursorError) {
node.error(cursorError); node.error(cursorError);
} }