Create multiple nodes in a single mutation
Feature Request
Feature request created due to conversation on the forum: https://www.graph.cool/forum/t/deeply-nested-create-mutations/2798
What feature are you missing? Create multiple nodes in a single mutation that aren't directly related.
There is more information in the forum link but here's a quick overview.
If a user has the following schema:
type Programmes {
title: String!
weeks: [ProgrammeWeek!]!
classes: [ProgrammeClass!]!
}
type ProgrammeWeek {
classes: [ProgrammeClass!]!
programme: Programme!
}
type ProgrammeClass {
title: String
description: String
class: Class
}
type Class {
title: String!
}
They should be able to run:
mutation {
createProgramme (
title: "I'm a test"
weeks: {
create: [
{
title: "Week Title"
classes: {
create: [
{
class: {
connect: {
id: "cjeeu4m2r00100124quldgnji"
}
},
{
class: {
connect: {
id: "cjeeu4m2r00100124quldgnji"
}
}
},
]
}
)
}
Ideally, the above mutation should add the newly created classes inside of weeks to the Programme type and ProgrammeWeek type. Currently it only adds them to the ProgrammeWeek type.
How could this feature look like in detail? Tradeoffs?
What about update and delete multiple nodes in a single mutation, not only create?