Overview
This node allows partial manipulation of existing data stored in a Redis database. It is useful when you want to update or modify specific fields inside Redis keys without overwriting the entire value. Common scenarios include updating user profile information stored as hashes, modifying JSON objects saved as strings, or appending/removing items from JSON arrays within Redis values.
For example:
- Updating a user's name field inside a Redis hash.
- Changing a nested property inside a JSON object stored as a string.
- Adding an item to a JSON array inside a Redis key.
- Removing the last item from a JSON array inside a Redis key.
This granular control helps maintain data integrity and reduces the need for full data replacement.
Properties
Name | Meaning |
---|---|
Key | The Redis key containing the data to manipulate (e.g., user:123:profile ). |
Field Name | The name of the field inside a Redis hash to update (used only for "Update Hash Field"). |
New Value | The new value to set for the specified field. Accepts valid JSON if needed. |
Preserve TTL | Boolean flag indicating whether to keep the original expiration time of the Redis key. |
Output
The node outputs an array of JSON objects, each representing the result of processing one input item. Each output object contains:
key
: The Redis key that was manipulated.operation
: The operation performed (e.g., "updateHashField").success
: Boolean indicating if the operation succeeded.result
: The updated data after manipulation:- For hash updates, this is the full hash object after modification.
- For JSON manipulations, this is the updated JSON object.
preservedTtl
: The remaining time-to-live (TTL) of the key if preserved; otherwisenull
.timestamp
: ISO timestamp of when the operation was performed.
The node does not output binary data.
Dependencies
- Requires a Redis server connection with credentials including host, port, optional username, password, and TLS configuration.
- The node depends on a Redis client library initialized internally.
- The Redis credentials must be configured in n8n prior to using this node.
Troubleshooting
- Key does not exist: If the specified Redis key does not exist, the node throws an error stating the key was not found. Ensure the key exists before running the node.
- Invalid JSON data: When manipulating JSON fields, if the stored data or the new value is not valid JSON, errors will occur. Validate JSON formatting before use.
- Field path not found: For JSON operations, if the specified field path does not exist, the node may create intermediate objects but will throw errors if the path is invalid during removal operations.
- Field is not an array: When removing from a JSON array, if the target field is not an array, an error is thrown.
- Preserve TTL issues: If preserving TTL but the key has no expiration or TTL is negative, the expiration will not be reset.
To resolve errors, verify the Redis key existence, validate JSON inputs, and ensure correct field names and paths.
Links and References
- Redis Documentation
- JSONPath Notation
- n8n Redis Integration Guide (generic Redis usage in n8n)