0.13.3 • Published 7 years ago
mongoose-paginate-cursor v0.13.3
mongoose-paginate-cursor
Installation
npm install mongoose-paginate-cursor
Usage
// body parser
var mongoose = require('mongoose');
var mongoosePaginate = require('mongoose-paginate-cursor');
var ModelSchema = mongoose.Schema({
title: String,
count: Number
});
ModelSchema.plugin(mongoosePaginate,{
// name: 'paged' // custom name of paginate function
})
var Model = mongoose.model('MyModel', ModelSchema);
var paged = await Model.paginate({
sinceId, // from what value to get documents (default: null)
maxId, // to what value to get documents (default: null)
limit, //amount of documents to get on search (default: 1)
select, //what values get on request
where, // query to match the search
keyPaginated, //key to paginate on document (ejm: 'count' ) (default: '_id')
reverse, //tell the pagination to reverse the search
});
paged.objects // objects found
paged.nextCursor // the key value of the next cursor
.paginate()
returns a promise, or can be used with a callback
.paginate({},callback)
Features to have
- Map: let the user map the documents
- QueryMap: let the user map the query to add chain calls
- Filter: filter documents and search more to reach the limit
- beforeCursor: cursor for before request
License: MIT
1.0.1
7 years ago
1.0.0
7 years ago
0.13.3
7 years ago
0.13.2
7 years ago
0.13.1
7 years ago
0.13.0
7 years ago
0.12.9
8 years ago
0.12.8
8 years ago
0.12.7
8 years ago
0.12.6
8 years ago
0.12.5
8 years ago
0.12.4
8 years ago
0.12.3
8 years ago
0.12.0
8 years ago
0.11.0
8 years ago
0.10.3
8 years ago
0.10.2
8 years ago
0.10.1
8 years ago
0.10.0
8 years ago
0.9.0
8 years ago
0.8.1
8 years ago
0.8.0
8 years ago