@r5v/mongoose-paginate 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,16 +86,16 @@ PagingQuery(Express.Request, mongoose.Model, options )
86
86
 
87
87
  #### Options
88
88
 
89
- | Key | Value | Description | Class Availability | Required | Default |
90
- |:-----------------|:---------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:---------|:--------|
91
- | disablePaging | boolean | disables paging and $paging param use | PagingQuery, AggregationPagingQuery | | false |
92
- | enableFilter | boolean | disables the $filter param on req. | PagingQuery, AggregationPagingQuery | | false |
93
- | single | boolean | disables paging on the query. converts from .find query to .findOne() | PagingQuery, AggregationPagingQuery | | true |
94
- | enablePostFilter | boolean | disables the ability to create a dynamic filter per request | AggregationPagingQuery | | false |
95
- | staticPostFilter | Mongo Filter Object | create a filter on the pipeline that is added after all the pipeline stages. this cannot be overwritten by params | AggregationPagingQuery | | {} |
96
- | staticFilter | Mongo Filter Object | create a filter on the pipeline that is added before all the pipeline stages. on find requests, this is added to the filter object. this cannot be overwritten by params | AggregationPagingQuery | | {} |
97
- | pipeline | MongoPipelineStage[] | pipeline request object. if the first item in pipeline stage is a $match or another required first stage operator. it will be placed before all other modifiers | AggregationPagingQuery | true | [] |
98
- | removeProtected | boolean | auto remove protected (select: false) for root Model | AggregationPagingQuery | | false |
89
+ | Key | Value | Description | Class Availability | Required | Default |
90
+ |:----------------------------|:---------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:---------|:--------|
91
+ | disablePaging | boolean | disables paging and $paging param use | PagingQuery, AggregationPagingQuery | | false |
92
+ | enableFilter | boolean | disables the $filter param on req. | PagingQuery, AggregationPagingQuery | | false |
93
+ | single | boolean | disables paging on the query. converts from .find query to .findOne() | PagingQuery, AggregationPagingQuery | | true |
94
+ | enablePostFilter | boolean | disables the ability to create a dynamic filter per request | AggregationPagingQuery | | false |
95
+ | staticPostFilter | Mongo Filter Object | create a filter on the pipeline that is added after all the pipeline stages. this cannot be overwritten by params | AggregationPagingQuery | | {} |
96
+ | staticFilter | Mongo Filter Object | create a filter on the pipeline that is added before all the pipeline stages. on find requests, this is added to the filter object. this cannot be overwritten by params | AggregationPagingQuery | | {} |
97
+ | pipeline | MongoPipelineStage[] | pipeline request object. if the first item in pipeline stage is a $match or another required first stage operator. it will be placed before all other modifiers | AggregationPagingQuery | true | [] |
98
+ | removeProtected \(REMOVED\) | boolean | auto remove protected (select: false) for root Model | AggregationPagingQuery | | false |
99
99
 
100
100
  ## Build
101
101
 
@@ -124,3 +124,7 @@ $ yarn run start
124
124
  6. \$count
125
125
  7. \$sort
126
126
  8. apply options
127
+
128
+
129
+ ## NOTES
130
+ 1. removeProtected removed from aggregation query due to inconsistent results after publication
@@ -1 +1 @@
1
- {"version":3,"file":"aggregationPagingQuery.d.ts","sourceRoot":"","sources":["../src/aggregationPagingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,SAAS,EAKZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAC,qBAAqB,EAAE,YAAY,EAAE,iCAAiC,EAAC,MAAM,WAAW,CAAA;AAQrG,qBAAa,sBAAsB;IAC/B,MAAM,EAAG,iCAAiC,CAazC;IACD,OAAO,EAAE,qBAAqB,CAM7B;IACD,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAA;IACxC,cAAc,EAAE,MAAM,EAAE,CAAK;IAC7B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;gBACL,GAAG,EAAE,OAAO,CAAC,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,qB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B;IACD,IAAI,qBAgCH;CAEJ"}
@@ -43,7 +43,6 @@ class AggregationPagingQuery {
43
43
  $preSort: {}
44
44
  };
45
45
  this.options = {
46
- removeProtected: true,
47
46
  enableFilter: false,
48
47
  enablePostFilter: false,
49
48
  enablePreSort: true,
@@ -67,7 +66,7 @@ class AggregationPagingQuery {
67
66
  };
68
67
  this.initQuery = () => __awaiter(this, void 0, void 0, function* () {
69
68
  const { $filter, $sort, $preSort, $select, $count, $postFilter } = this.params;
70
- const _a = this.options, { enableFilter, enablePreSort, enablePostFilter, staticFilter, staticPostFilter, removeProtected, pipeline } = _a, options = __rest(_a, ["enableFilter", "enablePreSort", "enablePostFilter", "staticFilter", "staticPostFilter", "removeProtected", "pipeline"]);
69
+ const _a = this.options, { enableFilter, enablePreSort, enablePostFilter, staticFilter, staticPostFilter, pipeline } = _a, options = __rest(_a, ["enableFilter", "enablePreSort", "enablePostFilter", "staticFilter", "staticPostFilter", "pipeline"]);
71
70
  this.query = this.model.aggregate();
72
71
  const [p1, ...pipes] = pipeline;
73
72
  const filterObj = { $and: [Object.assign({}, staticFilter)] };
@@ -102,9 +101,6 @@ class AggregationPagingQuery {
102
101
  if ($select) {
103
102
  this.query.project($select);
104
103
  }
105
- if (removeProtected) {
106
- this.removeProtectedFields();
107
- }
108
104
  if ($count.length) {
109
105
  this.createCounts();
110
106
  }
@@ -187,7 +183,6 @@ class AggregationPagingQuery {
187
183
  this.options = Object.assign(Object.assign({}, this.options), options);
188
184
  this.model = model;
189
185
  this.params = this.parseParams(this.params, req.query, true);
190
- this.protectedPaths = this.findProtectedPaths(model);
191
186
  this.initQuery();
192
187
  }
193
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r5v/mongoose-paginate",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {