【问题标题】:How to get all users at once with a GraphQL query?如何使用 GraphQL 查询一次获取所有用户?
【发布时间】:2020-12-31 23:10:42
【问题描述】:

使用 GraphQL 列出 101 个用户

为什么我在使用 PostGQL 时无法一次获得所有用户

它在使用 GraphQL 时只返回前 100 个用户,但在 GET 请求下工作正常。

GraphQL 查询

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

结果

使用 Get Method 返回完整集!

如果我使用GET,我可以得到GET /users?_limit=-1的完整数据集

注意:使用limit: -1 也不起作用。

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

  • Strapi 版本:3.4.1
  • 操作系统:Windows、Ubuntu
  • 数据库:Mysql、PostgreSQL
  • 节点版本:14.15.3
  • NPM 版本:6.14.9
  • 纱线版本​​:1.22.5

【问题讨论】:

    标签: graphql apollo apollo-server strapi


    【解决方案1】:

    GraphQL 插件的默认 amountLimit 为 100。您可以按照 here 的说明更改此限制

    【讨论】:

      猜你喜欢
      • 2017-05-04
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      • 1970-01-01
      • 2019-01-30
      • 2022-11-19
      • 1970-01-01
      相关资源
      最近更新 更多