c2-mongoose 2.1.147 → 2.1.149

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.
@@ -152,11 +152,10 @@ var SearchFlow = /** @class */ (function () {
152
152
  return new RegExp("".concat(regexExpression), 'i');
153
153
  };
154
154
  SearchFlow.prototype.searchNoPageable = function (model, options) {
155
- var _a;
156
155
  return __awaiter(this, void 0, void 0, function () {
157
- var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result, _b, _c, populate, _d, resultAux;
158
- return __generator(this, function (_e) {
159
- switch (_e.label) {
156
+ var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result, _a, _b, populate, _c, resultAux;
157
+ return __generator(this, function (_d) {
158
+ switch (_d.label) {
160
159
  case 0:
161
160
  stagesItems = [];
162
161
  if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
@@ -170,7 +169,6 @@ var SearchFlow = /** @class */ (function () {
170
169
  stagesItems.push({ $project: this.projection });
171
170
  }
172
171
  stagesItems.push({ $sort: this.sort });
173
- stagesItems.push({ $limit: (_a = this.limit) !== null && _a !== void 0 ? _a : 50 });
174
172
  stagesMetadata = [];
175
173
  if ((0, Utils_1.isNotEmpty)(options.metadata)) {
176
174
  stagesMetadata.push.apply(stagesMetadata, options.metadata);
@@ -188,20 +186,20 @@ var SearchFlow = /** @class */ (function () {
188
186
  },
189
187
  ]).session(options === null || options === void 0 ? void 0 : options.session)];
190
188
  case 1:
191
- result = _e.sent();
189
+ result = _d.sent();
192
190
  if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
193
- _b = 0, _c = this.populate;
194
- _e.label = 2;
191
+ _a = 0, _b = this.populate;
192
+ _d.label = 2;
195
193
  case 2:
196
- if (!(_b < _c.length)) return [3 /*break*/, 5];
197
- populate = _c[_b];
198
- _d = result[0];
194
+ if (!(_a < _b.length)) return [3 /*break*/, 5];
195
+ populate = _b[_a];
196
+ _c = result[0];
199
197
  return [4 /*yield*/, model.populate(result[0].items, populate)];
200
198
  case 3:
201
- _d.items = _e.sent();
202
- _e.label = 4;
199
+ _c.items = _d.sent();
200
+ _d.label = 4;
203
201
  case 4:
204
- _b++;
202
+ _a++;
205
203
  return [3 /*break*/, 2];
206
204
  case 5:
207
205
  resultAux = this.transformObject(result[0]);
@@ -476,7 +474,12 @@ var SearchFlow = /** @class */ (function () {
476
474
  }
477
475
  arr.push(val);
478
476
  }
479
- condition[key] = { $in: arr };
477
+ if (key.startsWith("notIn")) {
478
+ condition[key] = { $nin: arr };
479
+ }
480
+ else {
481
+ condition[key] = { $in: arr };
482
+ }
480
483
  }
481
484
  filters.$and.push(condition);
482
485
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.147",
3
+ "version": "2.1.149",
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",
@@ -149,7 +149,7 @@ abstract class SearchFlow {
149
149
 
150
150
 
151
151
  stagesItems.push({ $sort: this.sort })
152
- stagesItems.push({ $limit: this.limit ?? 50 })
152
+ // stagesItems.push({ $limit: this.limit ?? 50 })
153
153
 
154
154
  let stagesMetadata: any[] = []
155
155
  if (isNotEmpty(options.metadata)) {
@@ -428,7 +428,12 @@ abstract class SearchFlow {
428
428
  arr.push(val)
429
429
  }
430
430
 
431
- condition[key] = { $in: arr }
431
+ if (key.startsWith("notIn")) {
432
+ condition[key] = { $nin: arr }
433
+ }else{
434
+ condition[key] = { $in: arr }
435
+ }
436
+
432
437
  }
433
438
  filters.$and.push(condition)
434
439
  }