MichelDiz commented :
Well I’m reopening this due some changes and more info related to GraphQL standard.
The issue #2272 was solved, but it was specific for block arrays, with an example of payload
with array. But it did not go deep into adding an array to the var type itself.
Now I see that this issue appears to be more specific for this case.
As Dgraph intends to get closer to GraphQL’s standard. I believe this is a good feature for this.
In GraphQL you can add arrays to the variables used in a Query. e.g:
{
query: `
query events ($containsId: [Int]) {
# the parse results events(containsId: [1,2,3]) {
events(containsId: $containsId) {
id
name
}
}
`,
variables: {
containsId: [1,2,3]
}
}
UPDATE:
Also there’s an issue with Documentation that says about the possibility to use arrays for UID.
Check Get started with Dgraph
Testing in https://play.dgraph.io/ I can’t put a list of UIDs to work as docs says.
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”].
I’ve tested several combinations and none was successful as docs mention.
query q($name1:string = ["0x1878bd", "0x237702"]) {
me(func: uid( $name1 )) {
uid
name@en
director.film @filter(lt(initial_release_date, "1980-01-01")) {
initial_release_date
name@en
}
}
}
“0x1878bd, 0x237702” are “Ridley Scott” and “Steven Spielberg” uids.