Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-06-2021 12:53 PM
Hi there guys i was asking is there a way to implement create multiple relationships at a go in grand stack lets say you have a product that you want to add to multiple categories?
Solved! Go to Solution.
03-07-2021 07:47 AM
You can create custom Cypher mutations and do something like unwind a list of nodes you want to create relationships with. Otherwise, you'll have to do something like map over an array of things and run a single mutation per node you want to add a relationship to.
03-07-2021 07:47 AM
You can create custom Cypher mutations and do something like unwind a list of nodes you want to create relationships with. Otherwise, you'll have to do something like map over an array of things and run a single mutation per node you want to add a relationship to.
03-08-2021 09:22 AM
For the Product with different categories, I would suggest using labels.
Labels are the number 1 fastest thing in Neo4j and a node can have more then one.
Depend of how you deal with your categories.
06-02-2021 11:59 PM
Reviving this question in the wake of @neo4j/graphql
and its introduction of nested mutations.
Just in case I missed something, is there a way of generating a mutation query with an arbitrary number of nested subjects? To extend @fabish_kamz' question, I'd want to be able to specify any number of categories, including zero.
I'm pretty sure the answer is "no" and that I'd still need to run a mutation per target node, but I'd also like to be clear on whether the limitation is in this client library, the Apollo server or in GraphQL. If it's in the client library, it's something I could work around with sufficiently smart query-generating code, but if it's inherent then I can put that time to better use.
06-09-2021 10:51 PM
I asked this question in discord channel. Indeed there is a way to create multiple relationships from a node to multiple nodes but only works on updating. Which means that the nodes must exist before creating the relationships. There's no mechanism to do this on on Creating yet but they are working on it. If you're interested in knowing more join the neo4j discord channel.
06-10-2021 03:00 AM
Thanks for confirming that answer; I see which way I need to go, now.
And yes, I really should join the Discord channel.
All the sessions of the conference are now available online