Monday, December 30, 2019

mongoose-paginate-v2

I’ve developed this plugin to easily bring customized paginated results for NodeJS projects using MongoDB.

NPM Package: https://www.npmjs.com/package/mongoose-paginate-v2

Installation
npm install mongoose-paginate-v2

Usage
Add plugin to a schema and then use model paginate method:

const mongoose = require('mongoose');const mongoosePaginate = require('mongoose-paginate-v2');const mySchema = new mongoose.Schema({/* your schema definition */});mySchema.plugin(mongoosePaginate);const myModel = mongoose.model('SampleModel', mySchema);myModel.paginate().then({}) // UsageModel.paginate([query], [options], [callback])Returns promise

 

No comments:

Popular Posts