Hi
I have to make a edge assignment mutation based on the facet value but the looks like the mutation condition is not properly capturing the the facet value from the query block.
e.g
If the schema has user and roles and users can only be a single role and the condition is also based on a “since” facet on the assigned_role edge predicate.
e.g.
type user {
user_name
assigned_role
…
}
type role {
role_name
}
user_name: string @index(exact) .
role_name string @index((exact) .
assigned_role: uid @reverse .
// Conditional mutation based on the facet value. The following query is not working as expected and looks like the facet variable ‘s’ is not properly propagated to the mutation condition and so the mutation is never done even if the existing data matches the condition.
upsert {
query {
var(func: eq(user_name, "xyz123")) {
u as uid
assigned_role @facets(v as since)
}
var(func: eq(role_name, "admin")) {
r as uid
}
}
mutation @if(eq(len(u), 1) AND lt(val(v), "2020-10-30T10:10:10Z")) {
set {
uid(u) <assigned_role> uid(r) (since="2020-10-30T10:10:10Z") .
}
}
}