Skip to content

leonplondon/mongoose-paginate-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongoose-paginate-helper

A simple helper to query MongoDB using a paging-like fashion.

Loading helper

const helper = require('mongoose-paginate-helper');

The helper identifier now contains the only exported function with function firm:

async function (model, query, options);

Arguments specification.

/**
 * Pagination helper.
 * @param {Object} model Mongoose model's object, used interface of it.
 * @param {Object} query object query to perform.
 * @param {Object} options additional data
 * @param {Number} options.limit amount of results to retrieve.
 * @param {Boolean} options.lean when to perform lean queries.
 * @param {Object} options.fieldOrdering key-value pairs indicating results sorting.
 * @param {Object} options.select fields to project.
 * @param {Number} options.ordering use when _id base sorting, -1=desc 1=asc
 * @param {String} options.cursor id value from which start result retrieving.
 * @returns {Object} { list: [{}], cursor: 'string' }
 */

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published