Built‐in Server Values - GogoVega/node-red-contrib-firebase-realtime-database GitHub Wiki

The database provides two placeholder values, the first for auto-populating the current timestamp and the second to automatically increment the current database value by the provided delta. (available for versions >=0.5.3)

Timestamp

Returns a placeholder value for auto-populating the current timestamp (time since the Unix epoch, in milliseconds) as determined by the Firebase servers.

Usage

Send a payload which contains as a value the reserved word "TIMESTAMP", this value must be of type string and can be used in an array or an object. As the following example shows:

{
  payload: {
    string: "TIMESTAMP",
    array: [0, "TIMESTAMP", 1],
    object: {
      timestamp: "TIMESTAMP",
    },
  },
}

Regex Rule

The rule only accepts one or more spaces before and after the reserved word "TIMESTAMP". For all other cases, the value is considered as a STRING.

"TIMESTAMP" => Correct
" TIMESTAMP  " => Correct
"SELECT TIMESTAMP" => Incorrect
"Timestamp = time since the Unix epoch" => Incorrect

Increment

Returns a placeholder value that can be used to atomically increment the current database value by the provided delta.

Usage

Send a payload which contains as a value the reserved character word "INCREMENT [delta]", this value must be of type string and can be used in an array or an object. The delta must be a positive or negative Number. As the following example shows:

{
  payload: {
    string: "INCREMENT -1",
    array: [0, "INCREMENT 10", 1],
    object: {
      index: "INCREMENT 2",
    },
  },
}

[!NOTE] The DECREMENT keyword exists too. Used in the same way.

Regex Rule

The rule only accepts one or more spaces before and after the reserved word "INCREMENT [delta]". For all other cases, the value is considered as a STRING.

"INCREMENT 1" => Correct
" INCREMENT -1  " => Correct
"INCREMENT 1.123" => Correct
"INCREMENT 1." => Shows an error
" INCREMENT " => Incorrect
" Increment by 5" => Incorrect