即使我将限制设置为-1,strapi-grapql限制也只返回100个项目



当前我对strapi graphql查询有一些问题。我最多只能查询大约100个项目

以下是我的疑问:query StudioList { studios(limit: -1) { id slug name } }

无论有没有限制,总是返回100个项目。如何查询超过100个?谢谢

我找到了解决方案(这是旧版本,2020版本,我不记得了(:如果您的strapi中有plugins.js文件/config文件夹,然后添加以下代码:

module.exports = {
//
graphql: {
endpoint: '/graphql',
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
amountLimit: 2500,
apolloServer: {
tracing: false,
},
},
};

把金额限制改成你想要的。。然后重新启动服务器,现在它应该显示100多个项目。

我尝试了3.6.8版本的背带,但不起作用。我重建strapi";npm构建""纱线展开";

module.exports = {
//
graphql: {
endpoint: '/graphql',
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
amountLimit: 2500,
apolloServer: {
tracing: false,
},
},
};

我使用的是Strapi v4(带有TypeScript(,但这些解决方案都不适用于我。不过,我必须指出的是,我正在使用自定义GraphQL解析器。

对我有效的是更改该文件config/api.ts中的defaultLimitmaxLimit

文件如下所示:

export default {
rest: {
defaultLimit: 1000,
maxLimit: 2000,
withCount: true,
},
};

最新更新