Skip to content

Data Store

The datastore node runs a configured operation against one managed Smartunit data store. The result replaces msg.payload.

PropertyPurpose
NameFlow label.
OperationFixed operation performed by this node.
Data StoreManaged store used by the operation.
SQL QueryQuery text shown only for Execute Raw Query.
OperationInputOutput
Find Manymsg.optionsArray of matching records.
Find Onemsg.optionsFirst matching record or null.
Find & Countmsg.options{ items, total }.
Countmsg.optionsNumber of matching records.
Insert Itemmsg.payloadSaved record.
Update Itemmsg.criteria, msg.payloadFirst updated record matching the criteria.
Delete Itemmsg.criteriaSoft-delete result.
Delete AllNoneClear result.
Execute Raw Querymsg.parametersRaw query rows or provider result.

msg.options follows the managed repository’s TypeORM-style find options. msg.criteria identifies records for update or delete.

Use {{datastore}} in the SQL query where the selected table name belongs:

SELECT * FROM {{datastore}} WHERE status = ?

Pass bound values in msg.parameters:

["active"]

The node checks table references and allows only the configured data store table. Prefer normal operations when they can express the request.

Delete Item is a soft delete. Delete All clears the selected store and is irreversible from this node. Put authorization, confirmation, and logging before destructive paths.

Failures are reported with node.error and can be handled by a Catch node. The original message is supplied with the error.