prisma-extension-pagination
prisma-extension-pagination copied to clipboard
Add a skip option to the cursor pagination
For some reason, in most tutorials and articles about cursor pagination it is written that, unlike offset pagination, cursor does not allow you to jump to the desired page (skip a certain amount). But that's a lie! You can simply perform a normal cursor search and then skip the required amount. Thus, the advantages of the cursor and offset capabilities will remain, and the speed will hardly change (if you do not skip a lot).
https://github.com/neo4j/neo4j/issues/12695 https://arpitbhayani.me/blogs/fast-and-efficient-pagination-in-mongodb/ https://www.mongodb.com/docs/manual/reference/method/cursor.skip/
Even the prisma documentation says that with the cursor pagination, you need to skip 1 row in order not to include it in the result. What prevents you from skipping more?
I suggest adding a skip
and includePageCount
in the cursor pagination options and changing the meta accordingly.