c2-mongoose 2.1.323 → 2.1.325

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.
@@ -80,14 +80,11 @@ var SearcherV2Flow = /** @class */ (function () {
80
80
  facet.paging = pipelineFacetPaging;
81
81
  }
82
82
  facet.items = pipelineFacetItems;
83
- return [4 /*yield*/, model.aggregate([
84
- {
85
- $match: MatchFlowItem_1.default.exec(params.mainFilter, model)
86
- },
83
+ return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray([], MatchFlowItem_1.default.exec(params.mainFilter, model), true), [
87
84
  {
88
85
  $facet: facet
89
86
  }
90
- ])];
87
+ ], false))];
91
88
  case 1:
92
89
  result = _a.sent();
93
90
  ret = {};
@@ -1,6 +1,8 @@
1
1
  import mongoose from "mongoose";
2
2
  declare class MatchFlowItem {
3
- exec(filters: any, model: mongoose.Model<any>): any;
3
+ exec(filters: any, model: mongoose.Model<any>): {
4
+ $match: any;
5
+ }[];
4
6
  }
5
7
  declare const _default: MatchFlowItem;
6
8
  export default _default;
@@ -125,7 +125,7 @@ var MatchFlowItem = /** @class */ (function () {
125
125
  filtersFinal.$or = [];
126
126
  filtersFinal.$or = __spreadArray(__spreadArray([], filtersFinal.$or, true), orPayload, true);
127
127
  }
128
- return filtersFinal;
128
+ return [{ $match: filtersFinal }];
129
129
  };
130
130
  return MatchFlowItem;
131
131
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.323",
3
+ "version": "2.1.325",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,9 +41,7 @@ class SearcherV2Flow {
41
41
  facet.items = pipelineFacetItems
42
42
 
43
43
  let result = await model.aggregate([
44
- {
45
- $match: MatchFlowItem.exec(params.mainFilter, model)
46
- },
44
+ ...MatchFlowItem.exec(params.mainFilter, model),
47
45
  {
48
46
  $facet: facet
49
47
  }
@@ -105,7 +105,7 @@ class MatchFlowItem {
105
105
  }
106
106
 
107
107
 
108
- return filtersFinal
108
+ return [{ $match: filtersFinal }]
109
109
 
110
110
  }
111
111
  }