-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
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 version of Dgraph are you using?
dgraph:v20.03.0
Have you tried reproducing the issue with the latest release?
Already using latest version
What is the hardware spec (RAM, OS)?
MAC OS, 32GB RAM
Steps to reproduce the issue (command/config used to run Dgraph).
# Insert Node A with timestamp
{
set {
_:nodeA <dgraph.type> "NodeA" .
_:nodeA <nodeAId> "sb1" .
_:nodeA <timestamp> "2020-04-20T22:15:19.794Z" .
}
}
# Query nodeA too make sure it exist, use same query as upsert to test that its working
{
var(func: eq(nodeAId, "sb1")) {
existingTimestamp as timestamp
}
nodeA (func: le(val(existingTimestamp), "2020-04-20T22:15:19.794Z")) {
uid
timestamp
}
}
# Run upsert on NodeB
upsert {
query {
var(func: eq(nodeBId, "eb12")) {
nodeBId as uid
}
var(func: eq(nodeAId, "sb1")) {
existingTimestamp as timestamp
}
}
# create NodeB node if doesn't exist based on nodeA timestamp
mutation @if(le(val(existingTimestamp), "2020-04-20T22:15:19.794Z")) {
set {
uid(nodeBId) <createdAt> "2020-04-23T00:41:48.497Z" .
uid(nodeBId) <dgraph.type> "NodeB" .
}
}
}
Expected behaviour and actual result.
conditional upsert should work find on field other than uid.
Sample example given at following document is using uid only. In my case, I want to apply val on the predicate uid and then compare with corresponding value, but its not working.
https://dgraph.io/docs/master/mutations/#example-of-multiple-mutation-blocks
shaneu, grantsavage, shravan-v, prkasat, insanitybit and 2 more
Metadata
Metadata
Assignees
Labels
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.