The only way to make sure no new entries are created via GraphQL is by doing a mutation with the id passed instead of the name →
mutation updateStudentInCourse {
updateCourse(input: {filter: {name: {eq: "Spanish"}}, set: {students: {id: "0x1fbfc"}}}) {
numUids
}
}
If you wish to do it by name then you’ll have to do it from DQL via upsert (that’ll prevent new entries from being created).
However since there also exists an inverse property over here, we can use that and build a mutation for student (instead of mutation for course) →
mutation updateCourseInStudent {
updateStudent(input: {filter: {name: {eq: "Messi"}}, set: {courses: {name: "Spanish"}}}) {
numUids
}
}
This will only update if an entry with the name Messi exists. No new object creation will be done