queryWithVars -- how to specify multiple uids?

Posted by wiradikusuma:

Given this signature:

public Response queryWithVars(final String query, final Map<String, String> vars)

How do I pass multiple value (uids) with the same key?

campoy commented :

Hey @gitlw, I think you’re probably the best person to answer this question.

wiradikusuma commented :

Tried passing string “0xAAA,0XBBB” (comma-separated text) – doesn’t work :smiley:

campoy commented :

Hey @mangalaman93, please have a look at this issue.

mangalaman93 commented :

I don’t think we support passing multiple values in a variable, I can’t find an example for this in Dgraph or dgo repo.

mangalaman93 commented :

Related to Support lists in query variables (Dgraph's GraphQL Variable) · Issue #2726 · dgraph-io/dgraph · GitHub

MichelDiz commented :

BTW guys, a workaround for this would be something like

query q($name1:string = "Ridley Scott", $name2:string = "Steven Spielberg") {
  me(func: eq(name@en, [$name1, $name2])) {
    name@en
    director.film @filter(lt(initial_release_date, "1980-01-01"))  {
      initial_release_date
      name@en
    }
  }
}

You pass each value separately into variables. Hence use them as above.

Details of this support Support for Gql variable in arrays by srfrog · Pull Request #2981 · dgraph-io/dgraph · GitHub