c2-mongoose 2.1.324 → 2.1.326

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 = {};
@@ -23,6 +23,8 @@ var PopulateFlowItem = /** @class */ (function () {
23
23
  var _a, _b;
24
24
  var _c = populateField.split('.'), first = _c[0], rest = _c.slice(1);
25
25
  var fieldDefinition = modelRoot.schema.path(first);
26
+ if (!fieldDefinition)
27
+ return;
26
28
  var typeFirst = fieldDefinition.instance;
27
29
  if (typeFirst === 'Array') {
28
30
  if (rest === null || rest === void 0 ? void 0 : rest.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.324",
3
+ "version": "2.1.326",
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
  }
@@ -8,6 +8,7 @@ class PopulateFlowItem {
8
8
 
9
9
 
10
10
  let fieldDefinition = modelRoot.schema.path(first);
11
+ if (!fieldDefinition) return
11
12
  let typeFirst = fieldDefinition.instance
12
13
 
13
14
  if (typeFirst === 'Array') {