mongoose-paginate
mongoose-paginate copied to clipboard
Is this repo being maintained by someone?
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 How can you achieve total and pages directly in mongoose?
total
would be either countDocuments
(if the result set is small) or estimatedDocumentCount
. You can calculate pages
yourself.