The variables “From” and “to” are redundant. The variables fromUID and toUID should be used instead.
As far as I know, conditional upserts supports len only.
Other way of doing it.
upsert {
query {
q1(func: eq(xid, "` + from.Value() + `")) @filter(eq(dgraph.type, "Entity") {
from as uid
dgraph.type
}
q2(func: eq(xid, "` + to.Value() + `")) @filter(eq(dgraph.type, "Entity") {
to as uid
dgraph.type
}
}
mutation @if(gt(len(from), 0) AND gt(len(to), 0)) {
set {
(...)
}
}
}