nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 533 forks source link

Suggestion: switchable `page` and `offset` query param #695

Open Char2sGu opened 3 years ago

Char2sGu commented 3 years ago

Using offset and page to paginate data would cause serious performance problem when there are quite a lot of data and offset is pretty large. Usually we choose to paginate the data using filters like { id: { $gt: <id-of-the-last-retrieved-entity> } }, while the offset and page param is still available, so that attackers may be able to make the back-end run slowly by sending requests like ?page=99999 or ?offset=999999

kaneruan commented 3 years ago

I'm encounter this problem, hope to be able to use the ID page