mongoose-exec-paginate-plugin

2.0.0 • Public • Published

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
}

Package Sidebar

Install

npm i mongoose-exec-paginate-plugin

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • kulakowka