I'm trying to create a flow context variable in a Function Node to store an array which will be dynamically filled or emptied according to some logic. Unfortunately, it seems that the context variable does not work as I was expecting.
This is a minimal code to reproduce what I'm trying to do:
//Set the flow var with an empty array flow.set("test_var", ) // Update the flow variable flow.set("test_var", flow.get("test_var").push(5)) // Store flow var in msg.payload msg.payload = flow.get("test_var") return msg;
Looking at the code, I was expecting my
msg.payload equal to
 but, the returned result is a number (
What I'm doing wrong ?
Thank you in advance for your help.