Storage Events

In RUAL we use an easy to use Storage Management. This storage management includes an on-create, -remove, -update and -saved. These will be triggered whenever an document in the selected storage is created, removed, updated or saved. These events act like normal functions, within the events you can update, remove, etc. other documents, but be aware don't create an infinite loop of updates, it will crash your cluster.

On Created

Executes when a new document in the selected storage is created

On Removed

Executes when a document in the selected storage is removed

On Saved

Executes when a document in the selected storage is created or updated

On Updated

Executes when a document in the selected storage is updated


These events have multiple out-pins. These don't need to be used, but it is good to know what these pins do:

Current Document

The current document out-pin contains the new and updated document from the selected Storage. For the document_removed the current document is the document that is removed.

    {
        "city": "Pijnacker",
        "email": "astrid@testcompany.nl",
        "firstname": "Astrid",
        "lastname": "Wolken",
        "courses": [
            "3528349b1f09c2936b5dbc689583e37e1bd5412e6f163b2563a63ceaa3542ccc"
        ],
        "comment": "test test",
        "_meta": {
            "guid": "-",
            "expiry": -1,
            "entity": 17,
            "removed": 0,
            "created": 1566412759,
            "updated": 1586162591,
            "update_hash": "-",
            "storage": "demo_registrants"
        }
    }

Storage

The sorage out-pin contains the selected storage. You can use the storage pin for searches or update documents in the same flow.

    [
        "demo_registrants"
    ]

Revisions

The revisions out-pin contains an array with objects of all the changes made to the current document.

    [
        {
            "type": "set.field",
            "key": "comment",
            "value": "test test",
            "previous_value": "test test test"
        },
        {
            "key": "_meta.updated",
            "type": "set.field",
            "value": 1586162591,
            "previous_value": 1586162591
        }
    ]

Fields Modified

The Fields Modified out-pin contains an array with all of the field names with changed data.

    [
        "comment",
        "_meta.updated"
    ]