I want to update my node Course’s students with an existing student. I want it to do it by the @id attribute which is name. But it creates an new instance of Student. How can I achieve that?
mutation {
updateCourse(input:
{
filter: { name: {eq:"English"}},
set: {students: [{name:"John Xyz"}]}}) {
numUids
}
}
type Course {
id : ID!
name: String! @id
students : [Student] @hasInverse(field: courses)
}
type Student {
id : ID!
name: String! @id
courses : [Course]
}
Edit: Actually if it finds the node with specified name, updates edges.Howver if there is not a Student with that name I dont want it to create a new Student with given name. I need an error or something that blocks that behaviour, it is possible?