Join Slack
Powered by
Can I create and link a relationship at the same t...
# prisma-whats-new
p
peterp
09/01/2017, 1:17 PM
Can I create and link a relationship at the same time like I can with userId but for an one to many?
d
dankent
09/01/2017, 1:39 PM
I'm not sure exactly what scenario you are asking about but you can:
dankent
09/01/2017, 1:40 PM
- Use a nested create mutation to create multiple nodes and link them with relationships at the same time
dankent
09/01/2017, 1:41 PM
https://www.graph.cool/docs/reference/simple-api/nested-create-mutations-vaet3eengo/
dankent
09/01/2017, 1:42 PM
-Use a nested connect mutation to connect to connect multiple nodes while creating a node
dankent
09/01/2017, 1:42 PM
https://www.graph.cool/docs/reference/simple-api/nested-connect-mutations-tu9ohwa1ui/#nested-connect-mutations-for-to-many-relations
dankent
09/01/2017, 1:43 PM
Key thing is that at the to-many end of a 1-many relationship, the xIds field will be an array of strings rather than a string
dankent
09/01/2017, 1:44 PM
Exactly what you need to do depends on whether the nodes on either or both ends of the relationship already exist
p
peterp
09/01/2017, 6:13 PM
got it working, thanks so much!!
Open in Slack
Previous
Next