Posted in Uncategorized

Mongoose Handy function for reference

Some handy functions in mongoose

  • Pagination with mongoose

    
    npm install mongoose-paginate
    Model.paginate({}, { page: 3, limit: 10 }, function(err, result) {
    
    //result.docs
    // result.total
    // result.limit - 10
    // result.page - 3
    // result.pages
     });
    
Advertisements