# Combine several messages from MQTT into one request to DataBase

**URL:** https://discourse.nodered.org/t/combine-several-messages-from-mqtt-into-one-request-to-database/27915
**Category:** General
**Created:** [6 June 2020 20:10 UTC](https://discourse.nodered.org/t/combine-several-messages-from-mqtt-into-one-request-to-database/27915 "2020-06-06T20:10:34Z")
**Posts on this page:** 1
**Showing post:** 13

<div class="post-metadata">

### Author: ![SuperBoss9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superboss9/32/23462_2.png) [@SuperBoss9](https://discourse.nodered.org/u/SuperBoss9)
#### Post date: [6 June 2020 21:48 UTC](https://discourse.nodered.org/t/combine-several-messages-from-mqtt-into-one-request-to-database/27915/13 "2020-06-06T21:48:57Z")

</div>

> [@Steve-Mcl](#):
>
> If you gather all the values into one object, when do you write it to DB?

I assume that I should push it to DB as soon as I get all the values or timeout passed. Your note makes sense. If some of the topics is missed then I can wait for it until end of the world (or timeout).

As you see as DB I use InfluxDB that is not relational DB and is designed for storing sequences of data. And it is a really matter of the schema design. Here I have two options:

1. Store with narrow sequences (as at yours example). In that case I need to use different Measurements (Tables) to store different nature of data.
2. Use wide sequences (as I planned to do initially) where I have a number of Tags (qualifiers, keys) that will help me to select and combine data.

Option 2 is as it is described in the most examples at InfluxDB. Option 1 looks more reasonable in terms to processing of MQTT events. In that case I can use one single (I hope) function that will be universal.

Let me check the Option 1 also.

Anyway combining of several objects into one is also not bad timeleisure.

---

_[View the full topic](https://discourse.nodered.org/t/combine-several-messages-from-mqtt-into-one-request-to-database/27915)._
