Overview
This node interacts with the NATS JetStream Key-Value (KV) Store, allowing users to manage KV buckets and keys within those buckets. It supports operations such as listing keys, creating or deleting buckets, and manipulating key-value pairs.
The Key - List operation specifically lists keys stored in a specified KV bucket, filtered by a pattern. This is useful for scenarios where you want to retrieve all keys or a subset matching a naming convention, for example:
- Listing all user preference keys in a "user-preferences" bucket.
- Retrieving configuration keys starting with "config." in an "app-config" bucket.
- Fetching cache keys ending with ".settings" in a "cache-data" bucket.
Such functionality helps in managing and auditing stored data, performing batch operations, or dynamically discovering available keys.
Properties
| Name | Meaning |
|---|---|
| Bucket Name | The name of the KV bucket to operate on. Must contain only letters, numbers, underscores, and hyphens (no spaces or dots). Example: user-preferences, app-config, cache-data. |
| Key Pattern | Pattern to filter keys within the bucket. Use > to list all keys, or patterns like config.* (keys starting with config.), *.settings (keys ending with .settings). Examples: >, config.*, *.settings. |
Output
The output is an array of JSON objects representing the keys retrieved from the specified bucket that match the given pattern. Each item corresponds to one key entry.
- The
jsonfield contains the key information returned by the underlying NATS KV store. - If errors occur during execution, error details are included per item when "Continue On Fail" is enabled.
No binary data output is produced by this operation.
Dependencies
- Requires a connection to a NATS JetStream server with access to the KV store feature.
- Needs an API authentication credential configured in n8n to connect securely to the NATS server.
- Uses bundled NATS client libraries internally to perform KV operations.
Troubleshooting
- Invalid Bucket Name: Bucket names must only include letters, numbers, underscores, and hyphens. Spaces or dots will cause validation errors.
- Unknown Resource or Operation: If the resource or operation parameter is incorrect or unsupported, the node throws an error indicating the unknown value.
- Connection Issues: Failure to connect to the NATS server due to invalid credentials or network problems will result in errors.
- Pattern Syntax: Using an invalid key pattern may return no results or unexpected keys. Ensure patterns follow the documented syntax (
>,prefix.*,*.suffix). - Continue On Fail: When enabled, errors for individual items do not stop execution but are reported alongside successful results.