mongoose-exec-paginate-plugin
v2.0.0
Published
Mongoose plugin for pagination with offset
Downloads
1
Maintainers
Readme
mongoose-exec-paginate-plugin
Mongoose plugin for pagination with offset.
const execPaginate = require('mongoose-exec-paginate-plugin')
const options = {
limit: 3 // default offset
}
schema.plugin(execPaginate, )
const query = {
limit: 10, // override limit only for this query
offset: 10
}
Item
.find()
.select('name')
.sort('-createdAt')
.execPaginate(query)
{
"data": [
{
"_id": "585ae60d8fa6a4767f36c223",
"name": "Item 1"
}
],
"offset": 20
}