# Push data in one array

**URL:** <https://discourse.nodered.org/t/push-data-in-one-array/13387>\
**Category:** General\
**Created:** [17 July 2019 09:20 UTC](https://discourse.nodered.org/t/push-data-in-one-array/13387 "2019-07-17T09:20:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arul-B](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arul-b/32/10084_2.png) [@Arul-B](https://discourse.nodered.org/u/Arul-B)\
**Post date:** [17 July 2019 09:20 UTC](https://discourse.nodered.org/t/push-data-in-one-array/13387/1 "2019-07-17T09:20:09Z")

</div>

```auto
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 ???

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [17 July 2019 09:33 UTC](https://discourse.nodered.org/t/push-data-in-one-array/13387/2 "2019-07-17T09:33:26Z")

</div>

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

```auto
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
