mongoose-paginate icon indicating copy to clipboard operation
mongoose-paginate copied to clipboard

Is this repo being maintained by someone?

Open nouman91 opened this issue 7 years ago • 3 comments

nouman91 avatar Nov 27 '17 09:11 nouman91

Hi, I think you can achieve pagination directly in mongoose without effort right now:

await Model
    .find(query)
    .skip(pagination.skip)
    .limit(pagination.limit)
    .select(fields)
    .sort(sort);

it-nalon avatar Dec 03 '17 09:12 it-nalon

@it-nalon How can you achieve total and pages directly in mongoose?

toantd90 avatar Dec 23 '17 23:12 toantd90

total would be either countDocuments (if the result set is small) or estimatedDocumentCount. You can calculate pages yourself.

dskrvk avatar Jul 27 '18 15:07 dskrvk