Socket
Socket
Sign inDemoInstall

mongoose-paginate-v2

Package Overview
Dependencies
0
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.0 to 1.7.1

4

CHANGELOG.md
# Changelog
## v1.7.1
- Added support for custom find method.
## v1.7.0

@@ -4,0 +8,0 @@

8

dist/index.js

@@ -72,3 +72,4 @@ "use strict";

forceCountFn: false,
allowDiskUse: false
allowDiskUse: false,
customFind: 'find'
};

@@ -92,3 +93,4 @@

forceCountFn = _options.forceCountFn,
allowDiskUse = _options.allowDiskUse;
allowDiskUse = _options.allowDiskUse,
customFind = _options.customFind;

@@ -164,3 +166,3 @@ var customLabels = _objectSpread(_objectSpread({}, defaultOptions.customLabels), options.customLabels);

if (limit) {
var mQuery = this.find(query, projection, findOptions);
var mQuery = this[customFind](query, projection, findOptions);

@@ -167,0 +169,0 @@ if (populate) {

{
"name": "mongoose-paginate-v2",
"version": "1.7.0",
"version": "1.7.1",
"description": "A custom pagination library for Mongoose with customizable labels.",

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

@@ -82,2 +82,3 @@ ![Banner](static/banner.jpg)

- `[options]` {Object}
- `[select]` {Object | String} - Fields to return (by default returns all fields). [Documentation](http://mongoosejs.com/docs/api.html#query_Query-select)

@@ -94,7 +95,8 @@ - `[collation]` {Object} - Specify the collation [Documentation](https://docs.mongodb.com/manual/reference/collation/)

- `[customLabels]` {Object} - Developers can provide custom labels for manipulating the response data.
- `[pagination]` {Boolean} - If `pagination` is set to false, it will return all docs without adding limit condition. (Default: True)
- `[useEstimatedCount]` {Boolean} - Enable [estimatedDocumentCount](https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount/) for larger datasets. Does not count based on given query, so the count will match entire collection size. (Default: False)
- `[useCustomCountFn]` {Boolean} - Enable custom function for count datasets. (Default: False)
- `[forceCountFn]` {Boolean} - Set this to true, if you need to support \$geo queries. (Default: False)
- `[allowDiskUse]` {Boolean} - Set this to true, which allows the MongoDB server to use more than 100 MB for query. This option can let you work around QueryExceededMemoryLimitNoDiskUseAllowed errors from the MongoDB server. (Default: False)
- `[pagination]` {Boolean} - If `pagination` is set to false, it will return all docs without adding limit condition. (Default: `True`)
- `[useEstimatedCount]` {Boolean} - Enable [estimatedDocumentCount](https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount/) for larger datasets. Does not count based on given query, so the count will match entire collection size. (Default: `False`)
- `[useCustomCountFn]` {Boolean} - Enable custom function for count datasets. (Default: `False`)
- `[forceCountFn]` {Boolean} - Set this to true, if you need to support \$geo queries. (Default: `False`)
- `[customFind]` {String} - Method name for the find method which called from Model object. This options can be used to change default behaviour for pagination in case of different use cases (like [mongoose-soft-delete](https://github.com/dsanel/mongoose-delete#method-overridden)). (Default `'find'`)
- `[allowDiskUse]` {Boolean} - Set this to true, which allows the MongoDB server to use more than 100 MB for query. This option can let you work around QueryExceededMemoryLimitNoDiskUseAllowed errors from the MongoDB server. (Default: `False`)
- `[read]` {Object} - Determines the MongoDB nodes from which to read. Below are the available options.

@@ -104,2 +106,3 @@ - `[pref]`: One of the listed preference options or aliases.

- `[options]` {Object} - Options passed to Mongoose's `find()` function. [Documentation](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
- `[callback(err, result)]` - If specified, the callback is called once pagination results are retrieved or when an error has occurred

@@ -409,5 +412,5 @@

- https://github.com/Automattic/mongoose/blob/master/lib/query.js#L1008
- https://docs.mongodb.com/manual/core/read-preference/
- http://mongodb.github.io/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences
- <https://github.com/Automattic/mongoose/blob/master/lib/query.js#L1008>
- <https://docs.mongodb.com/manual/core/read-preference/>
- <http://mongodb.github.io/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences>

@@ -414,0 +417,0 @@ ## Known Issues

@@ -52,2 +52,3 @@ /**

allowDiskUse: false,
customFind: 'find',
};

@@ -77,2 +78,3 @@

allowDiskUse,
customFind,
} = options;

@@ -156,3 +158,3 @@

if (limit) {
const mQuery = this.find(query, projection, findOptions);
const mQuery = this[customFind](query, projection, findOptions);

@@ -159,0 +161,0 @@ if (populate) {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc