Search code examples
graphqlapolloapollo-serverstrapi

How to get all users at once with a GraphQL query?


List 101 Users with GraphQL

Why I can not get all users at once while using PostGQL?

It just returns first 100 users while using GraphQL but works fine with a GET request.

GraphQL Query

get users

    {
      users(limit: 101, sort: "username") {
        id
        username
      }
    }

Result

result

Using Get Method returns full set!

I can get the full data set by GET /users?_limit=-1 if I use GET

NOTE: using limit: -1 does not work either.

{
  users(limit: -1) {
    id
    username
  }
}

  • Strapi Version:3.4.1
  • Operating System: Windows, Ubuntu
  • Database: Mysql, PostgreSQL
  • Node Version: 14.15.3
  • NPM Version: 6.14.9
  • Yarn Version: 1.22.5

Solution

  • The default amountLimit for the GraphQL plugin is 100. You can change this limit as stated here