GraphQL bulk updates

Hi, good day!
Enjoying N8N a lot! At the moment we are diving into using GraphQL with N8N.
We are trying to do bulk updates. How do we go about that?

I have data like this:

"new_packages": [
{
"package_id": "P1",
"date": "2022-03-03",
"related_orders": [
{
"order_id": "ord_1",
}
{
"order_id": "ord_2",
}
]
},
{
"package_id": "P2",
"date": "2022-03-03",
"related_orders": [
{
"order_id": "ord_3",
}
{
"order_id": "ord_4",
}
]
}
]```

And we need to go through each package_id and then through each of the related orders and do the following:

mutation add_order_related_package {
update_orders(where:
{order_id: {_eq: “ord_1”}}, _set: {package_id: “P1”}
) {
returning {
id
}
}
}```
Of course, we need to repeat the above mutation/update for each package and its related orders.

We can do bulk insertions without any problems like this:

mutation insert_packing_slips {
  insert_sales_packing_slips(objects:
	{{JSON.stringify($node["packing_slips"].json).replace(/"order_id"/g,'order_id').replace(/"package_id"/g,'package_id')}}
) {
    returning {
      id
    }
  }
}```


But for updates, I am not sure how to proceed.
Any help will be really appreciated. 


Thanks in advance,
Mikael.

Hey @mast_ats, could you split out the new_packages field using an Item Lists node? You’d then have individual n8n items for each element in the new_packages array and could send them to the GraphQL node individually. n8n would then execute the GraphQL node for each item it receives so you wouldn’t have to do so manually.