Using uid_in when the uid is not known in advance but rather another predicate is known

According to the documentation, uid_in cannot accept a variable as the value for uid.

Is there a way, in a single call to dgraph (multiple queries, one network call), to find the relevant node using a different predicate, for example @filter(eq(name,"Bob")) then filter other nodes based on the uid of Bob. Or must I always do two calls to DGraph in order to fetch the nodes that have Bob in one of their recursive relations?

Hi @kesor, very timely post indeed. The support for variable inside uid_in is a heavily requested feature and currently being worked on. While this is still WIP have you tried looking at cascade directive if that solves your issue?

2 Likes

Hi @kesor, slightly later than I would have liked this to be, but we now support uid_in(relation, uid(variable)). Check out this PR: https://github.com/dgraph-io/dgraph/pull/5320 for examples.