Data storage

Create storages, fields and documents.
Learn about meta data and safeguard the one source of truth for every data value.

Create new storage

After importing data or processing a UI form, use the block storage: create document to make a new document. To create a storage, just type the name of the new storage in the search field and click to continue.
There is no need to set a data model to structure your data. The JSON format allows a flexible data model.

Create data field

It is always possible to add or remove fields to a storage later on. Try to re-use field definitions in different storages. A product has a name just like a supplier.
To add a new field to your cluster just enter a name in the search field and select a type for it. Field types are for example: value, number or object.

Manage storages

After creating a new storage, you can use it everywhere in your cluster. The only thing to decide is if you want to save revision data for your documents. Go to Data revisions to read more about this.

JSON source documents

With the right scope, users can see the JSON document in the frontend UI page, by clicking the right mouse button on a line in a data table and selecting JSON in the pop-up menu.

Document meta data

Each document in Rual automatically gets the object _meta with data concerning the document itself. The keys in the _meta object can be used as any other field. We often use the _meta.created and _meta.updated in data lists, or to sort data.

The _meta.guid is a unique identifier for the document. This means that you can change anything in the document, including the name, and you are still able to identify it.

Set document relations

The Rual storages are independent from each other. But often you want to set relations between documents from two or more different storages. This is where you use the field _meta.guid from the _meta object that every document has.
To set a relation between a product and a supplier for example, you add the field supplier_guid to the product.

Using the get document block, you can retrieve the supplier information anytime you need it.

One source of truth

Preventing data duplication is very important in every application. But if you want to show a product often in combination with the supplier name, it is more efficient to add that name to the product document. Use an object supplier instead of the supplier_guid field to update your product document with the name and the guid of the supplier. Choosing an object makes it easy to add other fields in the future, while keeping your document readable.

Update related documents

By using the supplier object in your product document you knowingly introduce duplicate data values.

In the next section Document events we will explain how to use the guid in the supplier object to update the product document automatically if the supplier data changes.

next course: Document Events

part of the Basic Rual Developer courses