Data Store
The datastore node runs a configured operation against one managed Smartunit
data store. The result replaces msg.payload.
Properties
Section titled “Properties”| Property | Purpose |
|---|---|
| Name | Flow label. |
| Operation | Fixed operation performed by this node. |
| Data Store | Managed store used by the operation. |
| SQL Query | Query text shown only for Execute Raw Query. |
Operations
Section titled “Operations”| Operation | Input | Output |
|---|---|---|
| Find Many | msg.options | Array of matching records. |
| Find One | msg.options | First matching record or null. |
| Find & Count | msg.options | { items, total }. |
| Count | msg.options | Number of matching records. |
| Insert Item | msg.payload | Saved record. |
| Update Item | msg.criteria, msg.payload | First updated record matching the criteria. |
| Delete Item | msg.criteria | Soft-delete result. |
| Delete All | None | Clear result. |
| Execute Raw Query | msg.parameters | Raw query rows or provider result. |
msg.options follows the managed repository’s TypeORM-style find options.
msg.criteria identifies records for update or delete.
Raw Queries
Section titled “Raw Queries”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.
Destructive Operations
Section titled “Destructive Operations”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.
Errors
Section titled “Errors”Failures are reported with node.error and can be handled by a Catch node. The
original message is supplied with the error.