Hi there!
How to say:
If doc X has field Y with value equal to Z do this mutation A
otherwise do mutation B.
Thanks
Something like this
upsert {
query {
v as var(func: type(Doc)) @filter(eq(fieldY, "Z"))
}
mutation @if(eq(len(v), 1)) {
set {
uid(v) <mutation> "A" .
}
}
mutation @if(eq(len(v), 0)) {
set {
uid(v) <mutation> "B" .
}
}
}
BTW, In GraphQL I think it isn’t possible. You should use lambda in order to use DQL there.
A followup question:
Either A and B would be atomic with the containing Transaction?
Would they get same T_start and T_comm ?
Thanks
What do you mean by atomic? That query is a single transaction.
Ok then, alright!!