var msgs = [];
msgs.push({payload: msg.payload[33]});
return [msgs];var msgs = [];
var data = [{payload: msg.payload.length}]; // Get the length, this seems to return a number
var foo = parseInt(data[0]); // I'm lost from this point on...
var bar = foo - 1; // I'm guessing I need th emax number - 1 to get the end of the array??
msgs.push({payload: msg.payload[bar]});
return [msgs];// Nope! Returns: Undefined--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/c24cc26e-48e8-4260-a5af-6c627784b26f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Nick, I am using your node yes, I'll give this method a go, all my functions are AFTER the mongo node so I'm seeing my mistake now where the query into the mongo node should be limiting the results not the function after the mongo node sifting through all the results, makes complete sense, will post successful flow if I get there for future hacks like myself.
You've certainly saved me a few strands of hair.