c2-mongoose 2.1.100 → 2.1.102

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.
@@ -460,7 +460,15 @@ var SearchFlow = /** @class */ (function () {
460
460
  condition[key] = value;
461
461
  }
462
462
  else {
463
- condition[key] = { $in: value };
463
+ var arr = [];
464
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
465
+ var val = value_1[_i];
466
+ if (typeof val === 'string' && _this.isValidObjectId(val)) {
467
+ val = new mongoose_1.Types.ObjectId(val);
468
+ }
469
+ arr.push(val);
470
+ }
471
+ condition[key] = { $in: arr };
464
472
  }
465
473
  filters.$and.push(condition);
466
474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.100",
3
+ "version": "2.1.102",
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",
@@ -385,7 +385,15 @@ abstract class SearchFlow {
385
385
  if (!Array.isArray(value)) {
386
386
  condition[key] = value
387
387
  } else {
388
- condition[key] = { $in: value }
388
+ let arr = []
389
+ for (let val of value) {
390
+ if (typeof val === 'string' && this.isValidObjectId(val as string)) {
391
+ val = new Types.ObjectId(val as string)
392
+ }
393
+ arr.push(val)
394
+ }
395
+
396
+ condition[key] = { $in: arr }
389
397
  }
390
398
  filters.$and.push(condition)
391
399
  }