c2-mongoose 2.1.296 → 2.1.298

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.
@@ -274,7 +274,12 @@ var SearcherFlow = /** @class */ (function () {
274
274
  condition[key] = { $nin: value };
275
275
  }
276
276
  else {
277
- condition[key] = { $in: value };
277
+ if (value.length > 0) {
278
+ condition[key] = { $in: value };
279
+ }
280
+ else {
281
+ condition[key] = value;
282
+ }
278
283
  }
279
284
  }
280
285
  else if (Array.isArray(value)) {
@@ -331,7 +336,7 @@ var SearcherFlow = /** @class */ (function () {
331
336
  ].includes(key)) {
332
337
  return;
333
338
  }
334
- if (typeof value === 'string' && _this.isValidObjectId(value) && key !== 'owner') {
339
+ if (typeof value === 'string' && _this.isValidObjectId(value) && key !== 'owner' && key !== 'identifier') {
335
340
  value = new mongoose_1.Types.ObjectId(value);
336
341
  }
337
342
  if (value === 'true') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.296",
3
+ "version": "2.1.298",
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",
@@ -251,9 +251,12 @@ class SearcherFlow<D> {
251
251
  if (key.startsWith("notIn")) {
252
252
  key = key.replace("notIn", "");
253
253
  condition[key] = { $nin: value };
254
- }
255
- else {
256
- condition[key] = { $in: value };
254
+ } else {
255
+ if (value.length > 0) {
256
+ condition[key] = { $in: value };
257
+ } else {
258
+ condition[key] = value;
259
+ }
257
260
  }
258
261
  } else if (Array.isArray(value)) {
259
262
  var arr = [];
@@ -311,7 +314,7 @@ class SearcherFlow<D> {
311
314
  return
312
315
  }
313
316
 
314
- if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner') {
317
+ if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner' && key !== 'identifier') {
315
318
  value = new Types.ObjectId(value as string)
316
319
  }
317
320