c2-mongoose 2.1.65 → 2.1.66

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.
@@ -204,6 +204,7 @@ var SearchFlow = /** @class */ (function () {
204
204
  case 1:
205
205
  result = _c.sent();
206
206
  items = result[0].items;
207
+ if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
207
208
  _i = 0, _b = this.populate;
208
209
  _c.label = 2;
209
210
  case 2:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.65",
3
+ "version": "2.1.66",
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",
@@ -136,8 +136,11 @@ abstract class SearchFlow {
136
136
  ).session(options?.session as ClientSession)
137
137
 
138
138
  var items = result[0].items
139
- for (var populate of this.populate) {
140
- items = await model.populate(result[0].items, populate)
139
+
140
+ if (isNotEmpty(this.populate) && Array.isArray(this.populate)) {
141
+ for (var populate of this.populate) {
142
+ items = await model.populate(result[0].items, populate)
143
+ }
141
144
  }
142
145
 
143
146
  return {