Skip to main content

Datastore Operations

The datastore is a database provided in the cloud. You can design fields on the admin panel and perform CRUD operations on the data using APIs.

The datastore exists within the project. A project can manage multiple datastores.

Retrieve datastores under the project

This retrieves all the datastores under the project.

const datastores = await project.datastores();

Retrieve specific datastore

To retrieve a specific datastore, specify the datastore ID.

const datastore = await project.datastore('DATASTORE_ID');

Create a new datastore

To create a new datastore, execute datastore without any arguments.

const newDatastore = await project.datastore();
newDatastore.name = {
ja: '新しいデータストア',
en: 'new datastore'
};

Save data to the datastore

To save to the datastore, execute the save method.

await newDatastore.save();

Update the datastore

To update the datastore, also execute the save method.

newDatastore.name = {
ja: '更新されたデータストア',
en: 'updated datastore'
};
await newDatastore.save();

Delete the datastore

To delete the datastore, execute the delete method.

await newDatastore.delete();

Retrieve fields

Retrieve all fields within the datastore.

const fields = await datastore.fields();

Retrieve specific field

To retrieve a specific field, specify the field ID.

const field = await datastore.field('FIELD_ID');

Retrieve actions operation

Retrieve the actions operation configured in the admin panel.

const actions = await datastore.actions();

Retrieve specific action operation

To retrieve a specific action operation, specify the action operation ID.

const action = await datastore.action('ACTION_ID');

Retrieve list of statuses

Retrieves the list of statuses configured in the admin panel.

const statuses = await datastore.statuses();

Retrieve datastore items

Searches for items stored in the datastore. params is optional.

const items = await datastore.items(params);

The conditions that can be specified are defined in the ItemList | Hexabase API ガイド

Also retrieve the number of search results

Retrieve the number of search results as well.

const { items, totalCount } = await datastore.itemsWithCount(params);