Passing Multiple Arguments to GraphQL Query

You can use GraphQL Aliases

{
    first: human(id: "1") {
        name
        height
    }
    second: human(id: "2") {
        name
        height
    }
}

First you need to extend you query by adding a "humans":

extend type Query {
  humans(listId: [String!]): [Human!]
  human(id: ObjID!): Human
}

Second - write a resolver for it.

Query: {
  humans(root, {listId}, { Human }) {
    return Human.fillAllByListId(listId);
  },
  ...
},

List of IDs could be passed as follows: pass list of IDs


Whit Hasura you can do like this (IDK if that working only on Hasura)

query getConfigurationList($ids: [String!]!) {
    configuration (where: {id:{_in: $ids}}){
        id
        value
    }
}

Here is the docs

Tags:

Sparql

Graphql