Pagination Flashcards

(3 cards)

1
Q

What is pagination?

A

It is dividing a dataset into small equal parts, so that the parts are sent to the clients in separate pages rather than all at once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you send a pagination request from the URL?

A

URL?page=val&limit=val

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you handle a pagination request in Mongoose?

A

if(req.query.page){const page = Number(req.query.page) || default value;const limit = Number(req.query.limit) || default value;const skip = (page - 1) * limit;query = query.skip(skip).limit(limit);}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly