Skip to main content

Merge Node

The Merge node receives multiple inputs (one per incoming connection). Internally it treats them as an array like:

  • input = [inputFromNodeA, inputFromNodeB, inputFromNodeC, ...]

Quick decision guide

  • Use Item mode when you have multiple lists that align by index and you want to combine fields per row.
  • Use Input mode when you want to append multiple inputs into one list (concatenate).

Parameters

runMode

The Merge node can be run in 2 different modes:

  • Item: merges items row-by-row (by index).
  • Input: merges inputs by concatenating (flattening) them.

1) Item mode (runMode: "item")

What it does

  • Expects each incoming input to be an array of objects.
  • Requires all input arrays to have the same length.
  • For each index i, it merges the objects from every input at that same index:
    • output item i = {...input1[i], ...input2[i], ...input3[i], ...}

If keys overlap, later objects overwrite earlier ones.

Requirements

  • The merge node input must be: array of arrays of objects
    Shape: Record<string, unknown>[][]
  • All arrays must have identical length, otherwise it errors.
  • Each element should be an object.

Examples

Example A — merge two lists (same length)

Input:

[
[
{ id: "a", name: "Dreamers" },
{ id: "b", name: "Outro" },
],
[
{ id: "a", tempo: 123.4 },
{ id: "b", tempo: 108.9 },
],
];

Output:

[
{ id: "a", name: "Dreamers", tempo: 123.4 },
{ id: "b", name: "Outro", tempo: 108.9 },
];

Example B — mismatched lengths (will error)

Input:

[[{ id: "a" }, { id: "b" }], [{ id: "a" }]];

2) Input mode (runMode: "input")

What it does

  • Treats the merge input as an array and returns a one-level flatten:
    • output = input.flat()

This is a concatenation-style merge. It does not merge objects together.

Requirements

  • The merge node input must be an array.
  • To get a “proper” flatten result, each incoming input should typically be an array.
  • No length constraints.

Example

Input:

[[{ id: "a" }, { id: "b" }], [{ id: "c" }]];

Output:

[{ id: "a" }, { id: "b" }, { id: "c" }];