As the date are the same you should use “less than or equal to” if you use lt it would never trigger.
upsert {
query {
q1(func: eq(user_name, "xyz123")) {
u as uid
user_name
assigned_role @facets(v as since)
}
me(){
T0 as max(val(v))
}
q2(func: eq(role_name, "admin")) {
r as uid
role_name
}
}
mutation @if(eq(len(u), 1) AND le(val(T0), "2020-10-30T10:10:10Z"))
{
set {
uid(u) <assigned_role> uid(r) (since="2020-10-30T10:10:10Z") .
uid(u) <user_name> "xyz123" .
uid(r) <role_name> "admin" .
}
}
}
BTW, this trick just works with one to one, that’s something in the backlog to be improved.