I have the following Type
type Program {
id: ID!
name: String! @id @search
website: String! @id
email: String
createdAt: DateTime @search
updatedAt: DateTime @search
}
and, I want to run the following mutation:
mutation {
updateProgram(input: {filter: {id: "0x97f54a4"},
set: {
name: "{{JSONForm1.formData.name}}",
website: "{{JSONForm1.formData.website}}",
email: "{{JSONForm1.formData.email}}",
updatedAt: "{{moment().format("X")}}"}}) {
numUids
}
}
However, I receive the error:
"message": "couldn't rewrite mutation updateProgram because failed to rewrite mutation payload because id example.com already exists for field website inside type Program"
The issue is that I’m changing on a form only the name
(from nameX to nameY), but the website
remains the same.
Same goes if I will keep the name
and website
as they are, and I’ll try to update email
from emailX to emailY.
I know that I could change the mutation and discard the website
, but this means that I have to use some kind of additional (workaround) hack in my forms to understand which fields changed or not in advance
dgraph version: v21.12