【发布时间】:2020-01-30 21:59:46
【问题描述】:
我想用skip和limit参数实现简单的分页
在文档中 (https://graphql.org/learn/pagination/) 我看到了:
我们可以做类似friends(first:2 after:$friendId)之类的事情来询问 在我们获取的最后一个朋友之后的接下来的两个。
但如果我在查询中传递 first 参数,我会得到错误:
"message": "未知参数 \"first\" 类型的字段 \"documents\" \"查询\".",
我的查询类型定义:
extend type Query {
documents(search: String, paragraphSize: Int, filters: DocumentFilters, sort: DocumentSort): [Document]
问题:我应该在我的文档端点中添加参数first并在服务器端自己处理所有限制/跳过/等,还是我错过了一些东西,GraphQL 自己处理所有限制等?
【问题讨论】:
标签: graphql apollo-server