var outputMsg = [];
var testName = msg.temperature;
var testValue = msg.humidity;
while (testName.length > 0) {
name = testName.shift();
value = testValue.shift();
outputMsg.push({name, value});
}
return [ outputMsg ];
How to make my data sensor in one array to store in database ???
Which data base do you want to store the data in?
If you read the info panel of the database node you are using it should tell you where it expects to see the data in the msg object.
You therefore need to return an object rather than an array.
But you could have an array in the msg.object eg
msg.payload = [];
msg.payload.push(msg.temperature);
msg.payload.push(msg.humidity);
return msg;
There are also some fantastic tutorials online about javascript objects and arrays, its well worth taking time to complete one as it is fundamental to using Node-RED