Support lists in query variables (Dgraph's GraphQL Variable)

dpkirchner commented :

@MichelDiz Sounds like I’m just confused. There’s GraphQL variable queries and there’s regular queries that look pretty similar, and you can’t pass multiple GraphQL variables to uid() (you’ll see “Only one GraphQL variable allowed inside uid function” which I include here as google bait).

I see now in the docs you linked: “Note If you want to input a list of uids as a GraphQL variable value, you can have the variable as string type and have the value surrounded by square brackets like [“13”, “14”].” That’s not exactly how it seems to work in my tests, at least when using dgraph-js. The way to query multiple uids is to concatenate an array of the hex uids into a single string that is wrapped with square brackets, like so:

query query($uids: string) {
  query(func: uid($uids)) {
    ...
  }
}
txn.queryWithVars(query, {vars: {
  $uids: '[' + uids.join(',') + ']'
}});

ultimately, $uids = '[0x123,0x456,0x789]' (no quotes in the array string, hex values).

I don’t know what’s really actionable here beyond, maybe, updating the “Note if you want …” text.