c2-mongoose 2.1.144 → 2.1.146

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.
@@ -98,7 +98,7 @@ var SearchFlow = /** @class */ (function () {
98
98
  }
99
99
  var populates = [];
100
100
  var _loop_1 = function () {
101
- if (property.include(".")) {
101
+ if (property.includes(".")) {
102
102
  return "continue";
103
103
  }
104
104
  var _b = property.split('.'), first = _b[0], rest = _b.slice(1);
@@ -106,7 +106,10 @@ var SearchFlow = /** @class */ (function () {
106
106
  var populate = this_1.buildPath(first, nested);
107
107
  if (Array.isArray(this_1.select)) {
108
108
  var selects = this_1.select.filter(function (sel) { return sel.startsWith("".concat(first, ".")); });
109
- populate.select = selects.map(function (sel) { return sel.split(".")[1]; }).join(" ");
109
+ var select = selects.map(function (sel) { return sel.split(".")[1]; }).join(" ");
110
+ if ((0, Utils_1.isNotEmpty)(select)) {
111
+ populate.select = select;
112
+ }
110
113
  }
111
114
  populates.push(populate);
112
115
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.144",
3
+ "version": "2.1.146",
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",
@@ -74,7 +74,7 @@ abstract class SearchFlow {
74
74
 
75
75
  var populates = [] as any
76
76
  for (var property of this.populate) {
77
- if (property.include(".")) {
77
+ if (property.includes(".")) {
78
78
  continue
79
79
  }
80
80
  let [first, ...rest] = property.split('.')
@@ -82,7 +82,10 @@ abstract class SearchFlow {
82
82
  let populate = this.buildPath(first, nested)
83
83
  if (Array.isArray(this.select)) {
84
84
  let selects = (this.select as []).filter((sel: string) => sel.startsWith(`${first}.`))
85
- populate.select = selects.map((sel: string) => sel.split(".")[1]).join(" ")
85
+ let select = selects.map((sel: string) => sel.split(".")[1]).join(" ")
86
+ if (isNotEmpty(select)) {
87
+ populate.select = select
88
+ }
86
89
  }
87
90
  populates.push(populate)
88
91
  }