-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.area/upsertIssues related to upsert operations.Issues related to upsert operations.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Description
What you wanted to do
I want to increment a scalar predicate with upsert operation.
If the counter predicate is missing in a record, upsert operation should be able to set initial value.
I cannot set initial value if predicate value is missing because there is no way to check if some variable is undefined.
What you actually did
upsert {
query{
q(func: uid(0x4e22)){
v as visit-count
incrementedValue as math(cond(v > 0, v+1, 1))
}
}
mutation {
set {
<0x4e22> <visit-count> val(incrementedValue) .
}
}
}
Why that wasn't great, with examples
I am getting following exception.
Error: t: : Expected a value variable in cond but missing.
There is no way to check if some variable is missing.
There should be a function isMissing(variable) to check if a variable is missing.
Any external references to support your case
shravan-v and paulrostorp
Metadata
Metadata
Assignees
Labels
area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.area/upsertIssues related to upsert operations.Issues related to upsert operations.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.