c2-mongoose 2.1.55 → 2.1.56

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.
@@ -17,7 +17,7 @@ declare abstract class SearchFlow {
17
17
  buildOrdenation(): any;
18
18
  buildRegex(searchText: string): RegExp;
19
19
  searchPageable(model: mongoose.Model<any>, options: SearchOptions): Promise<{
20
- items: any;
20
+ items: any[];
21
21
  paging: any;
22
22
  }>;
23
23
  search(model: mongoose.Model<any>, options?: SearchOptions): Promise<SearchResponse<any>>;
@@ -148,7 +148,7 @@ var SearchFlow = /** @class */ (function () {
148
148
  SearchFlow.prototype.searchPageable = function (model, options) {
149
149
  var _a;
150
150
  return __awaiter(this, void 0, void 0, function () {
151
- var stagesItems, result;
151
+ var stagesItems, result, items;
152
152
  return __generator(this, function (_b) {
153
153
  switch (_b.label) {
154
154
  case 0:
@@ -179,9 +179,9 @@ var SearchFlow = /** @class */ (function () {
179
179
  result = _b.sent();
180
180
  return [4 /*yield*/, model.populate(result[0].items, __assign(__assign({}, this.populate), { select: this.select }))];
181
181
  case 2:
182
- _b.sent();
182
+ items = _b.sent();
183
183
  return [2 /*return*/, {
184
- items: result[0].items,
184
+ items: items,
185
185
  paging: ((_a = result[0]) === null || _a === void 0 ? void 0 : _a.paging[0]) || { total: 0, page: 1, limit: this.limit }
186
186
  }];
187
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.55",
3
+ "version": "2.1.56",
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",
@@ -104,10 +104,10 @@ abstract class SearchFlow {
104
104
  ]
105
105
  ).session(options?.session as ClientSession)
106
106
 
107
- await model.populate(result[0].items, { ...this.populate, select: this.select })
107
+ let items = await model.populate(result[0].items, { ...this.populate, select: this.select })
108
108
 
109
109
  return {
110
- items: result[0].items,
110
+ items: items,
111
111
  paging: result[0]?.paging[0] || { total: 0, page: 1, limit: this.limit }
112
112
  }
113
113
  }