I am using the pre-built mutations and finding the set
part of the mutation isn’t doing what I would expect it to.
For example I have the mutation:
mutation EditEntryMutation(
$title: String!
$genres: [Genre]
) {
updateEntry(
input: {
filter: { title: { eq: $title } }
set: {
genres: $genres
}
}
) {
entry {
genres
}
}
}
I would expect that this operation replaces the list of genres with the new list, however it appends whatever values missing.
For example:
In my database I have the values genres: ["action", "drama"]
.
- If I run this mutation with the values
["action", "drama", "adventure"]
, the database will now have the values["action", "drama", "adventure"]
. - If I run this mutation with the values
["action"]
, the database will continue to have the values["action", "drama"]
. - If I run this mutation with the values
["romance", "fantasy"]
, the database will now have the values["action", "drama", "romance", "fantasy"]
. - If I run this mutation with and empty array
[]
, the database will continue to have the values["action", "drama"]
.
How can I do a mutation where it replaces the values rather then appending?