I try to make relationships between an Outfit node and multiple Product nodes. I am able to create a new Outfit node and then create Relationships between this node and the related product nodes. But is there a solution to no this in one query. My opinion is, that I have an array with the product Ids and then create a new outfit node, Match the node by ID for each value in the array and then create a relationship for each.
Do you have any suggestion? This is an example how it should look.
This is my approach, but there is an error with the where ID(a).
UNWIND keys({productIds:[1,2,3] }) AS key
Create (o:outfit {name: "Outfit für heute"})
FOREACH(item IN $list[key]
| Merge(a:article) where ID(a) = item.productIds
| MERGE (o)-[r:includes]->(a)
)
Thank you very much!
