Skip to content

Firebase OUT

Gauthier Dandele edited this page Sep 29, 2024 · 4 revisions

The Firebase OUT node connects to a Firebase Realtime Database and add/modify data to database for the defined path.

Below is the list and description of fields to configure for this node:

Database

Select or add a config-node. The config-node is your database on which this node will add/modify data for the defined path. Learn more about its role.

Method

Below is the list and description of query methods:

Set

Write or replace data to a defined path. This will overwrite any data at this location and all child locations. Passing null for the new value is equivalent to calling Remove, namely, all data at this location and all child locations will be deleted.

Push

Add data to a list in the database. Every time you push a new data onto a list, your database generates a unique key. The unique keys generated are ordered by the current time, so the resulting list of items is chronologically sorted. The keys are also designed to be unguessable (they contain 72 random bits of entropy).

Example:

You want to add the following data to the posts list:

{
  payload: {
    author: 'alanisawesome',
    title: 'The Turing Machine'
  },
  topic: 'posts'
}

Now your database contains:

{
  "posts": {
    "-JRHTHaKuITFIhnj02kE": {
      "author": "alanisawesome",
      "title": "The Turing Machine"
    }
  }
}

Update

As opposed to the Set method, Update can be use to selectively update only the referenced properties at the current location (instead of replacing all the child properties at the current location). A single Update will generate a single Value event at the location where the Update was performed, regardless of how many children were modified.

Note: payload must be an object!

Example:

Your database contains:

{
  "users": {
    "alanisawesome": {
      "date_of_birth": "June 23, 1912",
      "full_name": "Alan Turing",
      "nickname": "Alan The Machine"
    }
  }
}

To change the nickname of alanisawesome, you just need to set the following message:

{
  payload: {
    nickname: 'Alan is Genius'
  },
  topic: 'users/alanisawesome'
}

Remove

Removes the data at this database location. Any data at child locations will also be deleted.

Set Priority

Sets a priority for the data at this database location.

Set with Priority

Combination of Set and Set Priority methods.

Priority

The priority to apply to the data. Must be a positive Integer.

Path

The path to add/modify data. You can choose the string option to set the path statically or another option to set the path dynamically. By default, msg.topic.

Message Properties

Below are the properties of the incoming message:

  • payload: the data that will be sent to the database.
  • method: the query type to apply to the data.
  • priority: the priority to apply to the data. By default 1.
  • topic: the path of the data to add/modify. By default 'topic'.

Read more about message properties.

Next Step