This documentation will show how to save data, in the database ArangoDB, thanks to the autoDB node and how to use it too. In fact, there are three nodes autoDB :

  • to save data in a collection of the database
  • to clear a collection
  • to recover data from a collection of the database

So this documentation will explain how to use these three nodes.

The autoDB nodes

AutoDB out

First, the autoDB out node that allows to save data in a collection of the database.

It needs to indicate the name of the collection in which the node will save the data. Moreover, you can decided to store or not the received data by ticking or not the box at the bottom of the parameters window.

To do this, there is a autoDB config window available via the little pen at the right of the collection.

This window allows to add or delete some collection. Caution: all collections that are not delete will be create in the database.

AutoDB clear

Next, the autoDB clear node that allows to clear a collection of the database.

As the autoDB out node, it only requires the name of the collection which will be delete.

Note: this node returns the msg after deleting the collection.

AutoDB in

To finish, the autoDB in node that allows to recover data in a collection of the database.

It needs the name of the collection, as the other. It also requires the number of data the node will recover in the collection and the order in which the data will be recover.

The graph

Now, there is an example of graph that will store some positions in a collection named “location”. Moreover, there is 2 inject nodes to clear and recover the collection.

Owntracks

To begin this example, insert the owntracks node.

Then, as shown in the help of the node, choose a complicated topic so that it is not taken by someone else.

AutoDB

Next, add the 3 nodes describe in the section The autoDB nodes with the same parameters.

Inject

To clear and recover the collection, drag and drop 2 node inject.

And parametrize them like in the picture:

File

Finally, insert a file node to indicate a place where the collection will be stored on the Raspberry-Pi.

Set up the node like the picture shows:

Graph

To finish, link these node like this:

Flow

Here is the final code to be imported in order to recover the complete graph:

[{"id":"49d9a22a.d06404","type":"autoDB conf","collection":"location"},{"id":"2ac35dc4.5ab7c2","type":"autoDB out","name":"","collection":"49d9a22a.d06404","store":true,"x":387,"y":64,"z":"9dab5f23.535ae8","wires":[[]]},{"id":"33b95da3.079da2","type":"owntracks","name":"Location","broker":"test.mosquitto.org","port":1883,"clientid":"","topic":"","x":151,"y":64,"z":"9dab5f23.535ae8","wires":[["2ac35dc4.5ab7c2"]]},{"id":"f6f42be9.11e68","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":145,"y":150,"z":"9dab5f23.535ae8","wires":[["68527919.d0ed6"]]},{"id":"68527919.d0ed6","type":"autoDB clear","name":"","collection":"49d9a22a.d06404","x":346,"y":150,"z":"9dab5f23.535ae8","wires":[[]]},{"id":"59092348.aa2f1c","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":151,"y":233,"z":"9dab5f23.535ae8","wires":[["e41faa2d.141df"]]},{"id":"e41faa2d.141df","type":"autoDB in","name":"","collection":"49d9a22a.d06404","order":"DESC","count":"100","x":348,"y":233,"z":"9dab5f23.535ae8","wires":[["ed586c7c.a8343"]]},{"id":"ed586c7c.a8343","type":"file","name":"","filename":"location.txt","appendNewline":true,"overwriteFile":false,"x":565,"y":233,"z":"9dab5f23.535ae8","wires":[]}]

Back to top