Create many mutation not connecting relationships
See original GitHub issueWhen I run a createMany mutation with multiple objects connecting to the same user only one of the objects is added to the users relationship.
All of the posts however have a relationship to the user.
I would expect the user to relate to all of the posts not just one.
const userId = existingItem._id.toString();
const posts = postsData.map(post => ({
data: {
author: { connect: { id: userId } }
}
}));
await actions.query(
`mutation CreatePosts($posts: [PostsCreateInput]) {
createPosts(data: $posts) {
id
author {
id
}
}
}`,
{ variables: { posts } }
);
hypothesis: this is occurring because the connect runs in parallel and so the last post overrides the previous connect attempts.
This issue should not occur if I was to run multiple createSingle mutations in a loop.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Ability to connect if exists, otherwise create in GraphQL ...
Hello there, I'm wondering if it would be possible to implement some kind of upsert but for relational connections in mutations.
Read more >Auto-generated Mutation Does Not Create Relationship
Hello, I want to test auto-generated CRUD operations created by calling makeAugmentedSchema. There is no problem with creating nodes but - 23850.
Read more >How to create mutation with 3 or more nested relationships?
I do the following in the schema.graphql: type Mutation { createClient (input: createClientInput! @spread): Client @create } input ...
Read more >Using GraphQL Mutations to Manage Model Relationships
Those are, create, connect, reconnect and disconnect. So, we're going to jump into the API Explorer and just play around with these to...
Read more >Mutation with relationships - Atlas GraphQL API - MongoDB
So one Recipe has a one-to-many relationship with its Ingredients which have keys [_id, name]. How do I build the AddRecipeMutation?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here are the schemas
I have run some experiments and confirmed that the
Arcade
release has resolved this issue.