Limit
Description
Section titled “Description”The Limit node trims an array to keep only a set number of items, from the start or from the end. It is useful for keeping the first results of a search, taking the last records of a history log, or narrowing a dataset before processing it.
It is equivalent to n8n’s Limit node.
If no source is provided, the node operates on the array received in the previous node’s data. When data is not an array but contains an items or data property that is one, the node uses it automatically.
Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| source | text | No | Dot-notation path to the array within data. Empty = uses data directly. Example: items, result.rows |
| maxItems | number | Yes | Number of items to keep |
| keep | select | No | first (default): keeps the first items. last: keeps the last ones |
Output
Section titled “Output”The node returns the trimmed array directly (compatible with other nodes that expect an array):
[ { "id": 1, "name": "Ana" }, { "id": 2, "name": "Luis" }, { "id": 3, "name": "Marta" }]If the input is not an array (and has no items/data array), the node returns an error asking you to set source or connect a node that returns an array.
Usage Examples
Section titled “Usage Examples”First 10 results
Section titled “First 10 results”{ "label": "Top 10", "maxItems": "10", "keep": "first"}Returns the first 10 items of the input array.
Last 5 records of a history log
Section titled “Last 5 records of a history log”{ "label": "Last 5", "maxItems": "5", "keep": "last"}Keeps only the final 5 items of the array.
Limit a nested array
Section titled “Limit a nested array”{ "label": "First 3 rows", "source": "result.rows", "maxItems": "3", "keep": "first"}Takes the array located at result.rows and returns its first 3 rows.
- The
sourcefield supports dynamic and cross-node variables:{{@NodeName.field}},{{#N.field}} - If
maxItemsis greater than the number of items, it returns the whole array without error - Does not require credentials