Categories
My Projects

mongoose-paginate-v2


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



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({}) // Usage
Model.paginate([query], [options], [callback])
Returns promise

 


By Aravind NC

I love nothing more than challenging my skills as both designer and developer, it is both my hobby and my profession. I believe this makes me an exciting guy to work with as I am constantly pushing my skills and striving for perfection.

Leave a Reply

Your email address will not be published. Required fields are marked *