Skip to main content

Database

Overview

The Database Element is used to store key-value (KV) format data, handling common application scenarios swiftly. For more complex database usage scenarios, A Babel application can have multiple Database Elements, and you can select a specific Database Element when using or viewing.

Features

Schema structure

A Database Element is equivalent to a key-value (KV) database, where you can define the field names and field types for the value part.

images of database element

Quota

A single record in a Database Element can support up to 20KB, and each user is allocated 1GB of storage space.

Access

Access in the Database SDK

We provide a series of interfaces for the Database Element to manipulate data. Using the 'set' interface as an example, we will demonstrate how to insert a piece of data into the Database Element.

import { myDB } from '#elements';

...

myDB.set("David",{
"name": "David",
"actived": true,
"age": 66,
"hobbies":[
"sing",
"ai",
"nature"
]
})

...

For more examples of the Database SDK, please refer to the Database SDK section.

Access in the Executor

The Database Executor supports 'set', 'put', 'list', and 'delete' operations.

Please be aware that these operations directly manipulate the data of the Database Element. Exercise caution when using 'set' and 'delete' operations.

images of database executor

View data in the Dashboard

Babel also provides a way to view the data of Database Elements within the Dashboard. By clicking the database button in the top right corner of the Workspace, you can access the Database Dashboard.

images of workspace - click database dashboard

Here, you can view the data within different Database Elements.

images of database dashboard