I am still struggling to understand upserts
I have the following query that finds all of the uids that I want to update:
{
groupNote(func: has(Note.access)) @filter(eq(Note.isPublic, true)) @cascade {
uid
Note.isPublic
Note.access {
uid
ACL.grants {
uid
Contact.isGroup {
uid
Group.slug
}
}
}
}
}
This query works perfect. So I want to change the Note.isPublic
to false
. I figured that would be simple for an upsert…
upsert {
query {
groupNote as var(func: has(Note.access)) @filter(eq(Note.isPublic, true)) @cascade {
uid
Note.isPublic
Note.access {
uid
ACL.grants {
uid
Contact.isGroup {
uid
Group.slug
}
}
}
}
}
mutation {
set {
uid(groupNote) <Note.isPublic> "false" .
}
}
}
I get the response
{
"data": {
"code": "Success",
"message": "Done",
"queries": {},
"uids": {}
}
}
Which I guess is misleading to me. While it probably did what I told it to do, it did not do what I expected it to do. If I do the originaly query again, I still get the same results, meaning that Note.isPublic
was not updated to false