The reason that I can’t just put the values directly in the code is because they’re being provided by an incoming message. (This is a stream function using Apache Pulsar.) I’m sure the code to substitute the values is working fine. It’s been sufficiently tested. I think I actually got the idea of using a map to replace the values in one of the Dgraph repos, but I don’t remember exactly where.
Regarding:
{
getVals(func: has(products)) {
productsUid : uid
products @filter(eq(productId, 19610626)) {
productUid : uid
options @filter(eq(optionId, 32661491)) {
optionUid : uid
}
}
}
}
I like this approach, but when I use it in the upsert, I get the exception:
io.grpc.StatusRuntimeException: UNKNOWN: while parsing query: “{\n getVals(func: has(products)) {\n productsUid : uid\n \tproducts @filter(eq(productId, 19610626)) {\n productUid : uid\n options @filter(eq(optionId, 32661491)) {\n optionUid : uid\n }\n }\n }\n}”: Some variables are used but not defined