Pagination in GraphQL
We have slicing via limit: INT, but we do not have the ability to specify an offset. Are there plans to add this soon?
GraphQL Documentation actually specifies their pagination terms as follows:
first: int
offset: int
after: _id
Are there plans to implement this at all?
Hi all,
We recently announced that we have decided to deprecate the Atlas GraphQL API, and current users should’ve received an email explaining the details of the deprecation and end-of-life plan. Consequently, we will not be adding new features going forward and are updating the status for all related feedback accordingly.
Please read our announcement in the MongoDB Developer Center for more details and guidance on the migration process and timeline. Should you have any questions or need further assistance, please reach out to our support team via the MongoDB Support Portal.
We truly prioritize your satisfaction and success, and we thank you for your patience and the feedback you have provided us over the years.
-
Joseph commented
As someone putting a message in 2024 now, it is a bit crazy that this has never been worked on? It has been 3.5 years since the original request. I don't see why the default GraphQL schema doesn't expose the skip as a parameter?
This then poses the question of how this does this scale for further pagination requirements, such as sorting, searching etc. This is all stuff that would be easy to do with what they currently exposed, if they also exposed skip.
-
Tim commented
From what I gather, a custom resolver would primarily enable the use of pagination with an offset. Supporting a cursor with an 'after: _id' parameter would offer a more robust and fault-tolerant solution.
-
Guillaume MOREL-BAILLY commented
@Dev agree with you, but when you say "this was not available" someone can think that it's now available in their API. Unfortunately, not at this moment. The only solution is still to create a custom resolver and use an aggregation to pagination data.
-
Dev Acct commented
Blew my mind this was not available in their graphql api. Caused us major time sink/hassle.
-
Ian YOUNG commented
Pagination is such a standard feature which is essential on all but tiny datasets. Without doubt there should be a way to handle it built in by default. I don't understand why this isn't implemented. I can't see any downsides.
-
Tim commented
I agree. Without it, the usefulness of the Graphql interface is quite limited. Well, no progress in two years on this topic. I guess we have to use AWS or DGraph instead of MongoDb.
-
Rob Elliott commented
Agree. Please can we get an ETA for this.
-
Guillaume MOREL-BAILLY commented
ETA for this feature? We are in 2022 and it is difficult to understand why, such an important and critical feature, is not yet available.
-
I Putu Yoga commented
AWS AppSync has this. That would be great if Realm GraphQL supports this.
-
Petru commented
Would be great if this would be offered out of the box as it is a common pattern/solution in many use cases.
-
Colin commented
This is business critical for us as well first and offset would work well with most graphql clients. Here is the article on pagination from GraphQL Docs https://graphql.org/learn/pagination/
-
Yuriy commented
Hi Quinton,
I have been advised of a workaround including writing GraphQL Custom Resolver and function which accepts find and limit parameters.
However I still believe this has to be out of the box feature.
Regards