Cursor based pagination without numeric id available in table
When using cursor based pagination (https://www.prisma.io/docs/orm/prisma-client/queries/pagination#cursor-based-pagination) what if a table has no sequential number?
Imagine a Person table with an id which is a guid, or maybe just in the format
'firstname-lastname'
(like 'vivian-defoe'
).
And then I would like to do cursor based pagination in combination with an user supplied order (like via a REST api users can provide the sorting option like first_name
, last_name
, gender
, date_of_birth
, place_name_of_origin
.
Is that possible, or should I use offset pagination in that case?Prisma
Pagination (Reference)
Prisma Client supports both offset pagination and cursor-based pagination. Learn more about the pros and cons of different pagination approaches and how to implement them.
2 Replies
Hi @Marcel Overdijk 👋
Can you please take a look at this previous discussion on this same question? It goes into details.
GitHub
Cursor-based pagination without sequential cursor. · prisma prisma ...
Hi everyone, for Cursor-based pagination the docs https://www.prisma.io/docs/concepts/components/prisma-client/pagination says: "A cursor bookmarks your location in a result set and must be a ...
thx! I will read that.