🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mongo-cursor-pagination

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-cursor-pagination - npm Package Compare versions

Comparing version

to
3.0.1

2

package.json
{
"name": "mongo-cursor-pagination",
"version": "3.0.0",
"version": "3.0.1",
"description": "Make it easy to return cursor-paginated results from a Mongo collection",

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

@@ -253,2 +253,4 @@ # mongo-cursor-pagination

* 3.0.1 Fixed bug where the _id field was always returned when a paginatedField was used.
* 3.0.0 Breaking API change: `find()` no longer accepts a string for `limit`. Added `findWithReq`.

@@ -255,0 +257,0 @@

@@ -391,3 +391,3 @@ var paging = require('../');

it('should not include the paginatedField in the results if not desired', () => {
it('should not include fields not desired', () => {
var res = sync.await(paging.find(db.collection('test_paging_custom_fields'), {

@@ -400,3 +400,5 @@ limit: 1,

}, sync.defer()));
expect(res.results[0].timestamp).toBeUndefined();
expect(res.results[0]).toEqual({
counter: 6
});
expect(res.next).toEqual(jasmine.any(String));

@@ -488,2 +490,2 @@ });

});
});
});

@@ -172,6 +172,7 @@ var _ = require('underscore');

// If the user didn't include the paginated field in their desired fields and we included
// it for them, remove it.
if (params.fields && !_.has(params.fields, params.paginatedField)) {
response.results = _.map(response.results, result => _.omit(result, params.paginatedField));
// Remove fields that we added to the query (such as paginatedField and _id) that the user didn't ask for.
if (params.fields && (!_.has(params.fields, params.paginatedField) || !_.has(params.fields, params.paginatedField))) {
response.results = _.map(response.results, result => {
return _.pick(result, _.keys(params.fields));
});
}

@@ -181,2 +182,2 @@

});
};
};