Dgraph version: 21.12
We are trying to upsert some nodes using the upsert mutation block, the “primary key” of the node type can have double quotes inside the value. The mutation works as expected (with no duplicates) if the predicate does not have double quotes inside but creates duplicates when the value has duplicates.
dql schema
type software {
name string
last_seen
}
name: string @index(exact, trigram) @upsert .
last_seen: dateTime @index(hour) .
e.g. Conditional upsert is always creating a new node even though the query matches an existing node.
upsert {
query {
var(func: eq(name, "xyz \"abc\" 123")) {
s as uid
}
}
mutation @if(eq(len(s), 1)) {
set {
uid(s) <update_time> "2021-12-12" .
}
}
mutation @if(eq(len(s), 0)) {
set {
uid(s) <name> "xyz \"abc\" 123" .
uid(s) <update_time> "2021-12-12" .
}
}
}