Overview
The node, named "Datastore Node," is designed to perform operations related to a datastore within an n8n workflow. It supports three main operations: setting a property in the datastore, getting a property from the datastore, and clearing a property in the datastore. The current implementation of the execute() method primarily logs input data and returns a JSON object indicating which operation was invoked along with a timestamp. This node can be useful for workflows that need to track or manipulate key-value pairs in a datastore context, such as saving configuration values, retrieving stored settings, or clearing outdated data.
Practical examples:
- Set Datastore Property: Save a user preference or API token during a workflow execution.
- Get Datastore Property: Retrieve a previously saved configuration value to use in subsequent steps.
- Clear Datastore Property: Remove sensitive information or reset a stored value after it is no longer needed.
Properties
| Name | Meaning |
|---|---|
| Field in Datastore | The specific field/key in the datastore to operate on (e.g., "spreadsheet_id"). |
| Value in Datastore | The value to save into the specified datastore field. Can be a string or JSON-formatted string (e.g., "val" or {"key":"value"}). Only used for the "Set Datastore Property" operation. |
Output
The node outputs an array containing one item with a JSON object that includes a single property:
key: A string indicating the operation performed concatenated with the current ISO timestamp, e.g.,"setDatastoreProperty 2024-06-01T12:00:00.000Z".
No actual datastore manipulation or retrieval occurs in the current code; the output serves as a placeholder or log of the requested operation.
The node does not output any binary data.
Dependencies
- No external services or APIs are called by this node based on the provided source code.
- No special credentials or environment variables are required.
- The node depends on the
n8n-workflowpackage for error handling and node utilities.
Troubleshooting
- Operation Not Implemented Error: If an unsupported operation is specified, the node throws an error stating the operation is not implemented. Ensure the operation parameter is one of
"setDatastoreProperty","getDatastoreProperty", or"clearDatastoreProperty". - No Actual Datastore Effect: Users might expect the node to interact with a real datastore, but currently, it only returns a JSON object with the operation name and timestamp. To implement real datastore functionality, additional code would be necessary.
- Input Data Logging: The node logs input data to the console, which may clutter logs if used extensively. This is mainly for debugging purposes.