Mongo add full json


I am trying to add the full Json set via the mongo ingration node.

But my question is how do make so it add the full jason without that i need to all all fields into the node?


Sorry, I do not fully understand what you mean. But something like you want to save something to MongoDB but not all the data, just some of it?

If that is it, then you can either just define the data you want with the Set-Node and make sure to set “Keep Only Set” to true. As an alternative, you could also use the Function-Node.

Does that help?

Hi Thanks for you answer

I would like to add the full json without need to specify the fields in the Mongo node.

I dont see the alternative you mention.

Most likly me that dont get it:)

Kind regards

Ah now I understand what you mean. In that case you can simply set an expression like this:


So like in this example workflow:

That should do the trick.

1 Like

Thanks you works great !

Awsome software:)

Just hope that we can solve the issue so we can have static webhooks soon:=)

Thanks a lot, that is great to hear!

Yes, I hope we can look into this soon as it could also help to partly solve some scaling issues.

Hi I got a little new issue

Everything worked fine as long as the there ware not to many level

So what i mean is that it worked when i had only the raw data


items[0].json = {
  a: 1,
  b: 2,
  c: 3
return items;

But when i get a Json like this and would only like to store in mongo what is below body that mean maindata (and whats under) and other data {and what is under)

items[0].json = {

  "a": "1",
  "b": "2",
  "c": "3"
  "a": "1",
  "b": "2",
  "c": "3"
return items;

I tried
{{Object.keys($node["Webhook"].json["body"]).join(', ')}} but then did i only got added main data and other data as headings but NOT the data under them

I might be abit dumb here but :slight_smile:

Sorry but I do not understand. Only the main level keys have to be set in “Fields”. It then automatically adds all data underneath it. So the expression does not have to change.

To be sure I just tested it myself. And all lower levels got added just fine.

Here my simple test:

I know what he means. He has an JSON object with nested objects. He wants to only populate one of the nested objects into the database.

Base Object:

  "event": { .. },
  "location": { .. },
  "area": { .. }

Store location in mongo db:

   "shipID": "..",
   "locationKey": "..",
   "other": ".."

Thanks a lot @jwillmer! That is very helpful

@Mattias_Larsson think now I understand better. To allow exactly that the parameter “fields” exist. If you write in it maindata,otherdata then it will only use the two you want.
Or do you want to save “maindata” in one mongo document and “otherdate” in a separate?

That’s why we have a good CTO.

I would in this case like to store all the data under body. That mean Inthis case that I would like to store both maindata and othedata Inthe same mongo record. In the future this might be different but for now that is the case :).

Kind regards

Ah ok understand. Then you have to do it like this:


@jan Hi, hope you guys are fine ! I just tested n8n and it’s really handsome :open_mouth:
Can you to tell me how to pass an array of documents instead of one document in your previous conf?
I need to seed my mongodb collection with an array of documents