Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-paginate-v2

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-paginate-v2 - npm Package Compare versions

Comparing version 1.0.19 to 1.0.20

25

index.js

@@ -7,3 +7,3 @@ /**

* @param {Object|String} [options.customLabels]
* @param {Object|} [options.collation]
* @param {Object} [options.collation]
* @param {Array|Object|String} [options.populate]

@@ -61,3 +61,3 @@ * @param {Boolean} [options.lean=false]

const count = this.count(query).exec();
const count = this.countDocuments(query).exec();

@@ -70,3 +70,3 @@ const model = this.find(query);

// Hack for mongo < v3.4
if (Object.keys(collation).length > 0) {
if (Object.keys('collation').length > 0) {
model.collation(collation);

@@ -117,3 +117,3 @@ }

result[labelTotalPages] = pages;
result[labelPagingCounter] = ((page - 1) * limit) + 1;
result[labelPagingCounter] = ((page - 1) * limit) + 1;

@@ -138,8 +138,3 @@ // Set prev page

// Adding support for callbacks if specified.
if (callback) {
process.emitWarning(
'mongoose-paginate-v2: callback will be removed from future versions, use promise instead.',
'DeprecationWarning'
);
if (typeof callback === 'function') {
return callback(null, result);

@@ -149,7 +144,7 @@ } else {

}
}).catch(function (error) {
if (callback) {
return callback(error);
}).catch(function (reject) {
if (typeof callback === 'function') {
return callback(reject);
} else {
return Promise.reject(error);
return Promise.reject(reject);
}

@@ -166,2 +161,2 @@ });

module.exports.paginate = paginate;
module.exports.paginate = paginate;

2

package.json
{
"name": "mongoose-paginate-v2",
"version": "1.0.19",
"version": "1.0.20",
"description": "A cursor based custom pagination library for Mongoose with customizable labels.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -46,2 +46,3 @@ # mongoose-paginate-v2

- `[select]` {Object | String} - Fields to return (by default returns all fields). [Documentation](http://mongoosejs.com/docs/api.html#query_Query-select)
- `[collation]` {Object} - Specify the collation [Documentation](https://docs.mongodb.com/manual/reference/collation/)
- `[sort]` {Object | String} - Sort order. [Documentation](http://mongoosejs.com/docs/api.html#query_Query-sort)

@@ -82,3 +83,6 @@ - `[populate]` {Array | Object | String} - Paths which should be populated with other documents. [Documentation](http://mongoosejs.com/docs/api.html#query_Query-populate)

page: 1,
limit: 10
limit: 10,
collation: {
locale: 'en'
}
};

@@ -85,0 +89,0 @@

@@ -7,3 +7,3 @@ 'use strict';

let MONGO_URI = 'mongodb://127.0.0.1/mongoose_paginate_test';
let MONGO_URI = 'mongodb://localhost/mongoose_paginate_test';

@@ -30,3 +30,3 @@ let AuthorSchema = new mongoose.Schema({ name: String });

before(function(done) {
mongoose.connect(MONGO_URI, done);
mongoose.connect(MONGO_URI, {useNewUrlParser: true}, done);
});

@@ -86,3 +86,7 @@

var options = {
sort: { _id: 1}
sort: { _id: 1},
collation: {
locale: 'en',
strength: 2
}
};

@@ -105,7 +109,5 @@

/*
it('with $where condition', function() {
var query = {
title: {
$in : [/Book/i]
} ,
var query = {
'$where': 'this.price < 100'

@@ -133,3 +135,5 @@ };

});
*/
it('with custom labels', function() {

@@ -136,0 +140,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc