Enrich / combine in Merge node

Hi everyone, I can’t understand if I do something wrong, or if there’s a problem when using a Merge node with the Combine / Enrich options…

Situation

I defined a very simple example, with two Code nodes:

  • the first one returns {'first': 'Hello', 'second': 'world'}
  • the second one returns {'second': '!!'}
    I expect the merge to return {'first': 'Hello', 'second': 'world!!'} so I configured the Merge node as seen below:
    merge_options

However the response is still {'first': 'Hello', 'second': 'world'}, and I didn’t find a way to get the expected result (expect for configuring Output Type : keep everything and then merging the second key with a Code node, which works but is not particularly ideal)

Workflow

Any idea about that ?

n8n setup

  • n8n version: 1.55.3
  • Database (default: SQLite): PostGRES
  • n8n EXECUTIONS_PROCESS setting (default: own, main): never found out
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Debian 12

Bests,
Benjamin

Hi @bennhatton

That is not how the merge works. It is meant for merging record by a key, for example an id.

Please have a look at the courses and or video courses it should explain it a bit more. :slight_smile:

Hi @BramKn , thanks for your answer, you’re right I misunderstood the goal of the merge node.

I face this same problem quite often: being able to enrich the data returned by one node with data returned by another one. Do you have any idea of how I can achieve this with a rather generic solution (I mean no Code node with the corresponding keys hardcoded) ?

Thanks,
Benjamin

Merge by key and then use a set node after it to do the actual enriching.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.