How to use the mongo-cursor-pagination.mongoosePlugin function in mongo-cursor-pagination

To help you get started, we’ve selected a few mongo-cursor-pagination examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iceener / rest-api-in-practice-node-js-source / 07-pagination / end / cursor-based-pagination / src / models / song.js View on Github external
import mongoose from 'mongoose';
import URLSlugs from 'mongoose-url-slugs';
import mongoPagination from 'mongo-cursor-pagination';

const Song = mongoose.Schema({
    title: String
}, {
   timestamps: true
});

Song.plugin(URLSlugs('title', { field: 'slug', update: true }));
Song.plugin(mongoPagination.mongoosePlugin);

export default mongoose.model('Song', Song);

mongo-cursor-pagination

Make it easy to return cursor-paginated results from a Mongo collection

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis