Overview
This node allows partial manipulation of existing data stored in a Redis database. It is designed to update or modify specific parts of JSON objects or hashes stored under Redis keys without replacing the entire value. Common use cases include updating user profiles, appending items to arrays within JSON objects, or modifying fields inside Redis hashes.
For example, you can append a new item to a user's list of notifications stored as a JSON array in Redis, or update a nested field like user.name
inside a JSON object without overwriting other data. This granular control helps maintain data integrity and reduces the need for full data retrieval and rewriting.
Properties
Name | Meaning |
---|---|
Key | The Redis key containing the data to be manipulated (e.g., user:123:profile ). |
Field Path | The path to the field to update inside the JSON object, using dot notation for nested fields (e.g., user.name or items[0].title ). Required for JSON operations. |
New Value | The new value to set for the specified field. Accepts valid JSON strings if needed. Used in update and append operations. |
Preserve TTL | Boolean flag indicating whether to keep the original expiration time (TTL) of the Redis key after modification. |
Output
The node outputs an array of JSON objects, each corresponding to one input item processed. Each output object contains:
key
: The Redis key that was manipulated.operation
: The operation performed (e.g.,appendJsonArray
).success
: Boolean indicating if the operation succeeded.result
: The updated data structure after the operation (either the updated JSON object or hash).preservedTtl
: The TTL value preserved if the "Preserve TTL" option was enabled; otherwise, null.timestamp
: ISO string timestamp of when the operation was performed.
If the node manipulates binary data, it would typically relate to Redis values, but this implementation focuses on JSON and hash data only.
Dependencies
- Requires a Redis server connection with appropriate credentials (host, port, username, password, TLS options).
- The node depends on a Redis client wrapper initialized internally.
- Requires configuration of Redis credentials in n8n to authenticate and connect.
Troubleshooting
- Key does not exist: If the specified Redis key does not exist, the node throws an error stating the key is missing. Ensure the key exists before running the node.
- Invalid JSON data: When manipulating JSON fields or arrays, if the stored data is not valid JSON, parsing will fail. Verify that the Redis key contains valid JSON.
- Field path errors: If the specified field path does not exist or is invalid (e.g., trying to remove from a non-array field), the node will throw descriptive errors. Double-check the field path syntax and data structure.
- TTL preservation issues: If preserving TTL is enabled but the key has no TTL or expired, the TTL may not be restored correctly.
- General Redis connection errors: Network issues or incorrect credentials will cause connection failures. Confirm Redis server accessibility and credential correctness.
Links and References
- Redis Documentation
- JSONPath Notation Guide
- n8n Redis Integration Docs (for general Redis usage in n8n)