c2-mongoose 2.1.303 → 2.1.305

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.
@@ -261,7 +261,7 @@ var SearcherFlow = /** @class */ (function () {
261
261
  }
262
262
  else if (key.endsWith("IsEmpty")) {
263
263
  key = key.replace("IsEmpty", "");
264
- condition[key] = { $size: value ? 0 : { $gte: 1 } };
264
+ condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
265
265
  }
266
266
  else {
267
267
  if (((_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.paths[key]) === null || _c === void 0 ? void 0 : _c.instance) === 'Array') {
@@ -283,7 +283,7 @@ var SearcherFlow = /** @class */ (function () {
283
283
  }
284
284
  else if (key.endsWith("IsEmpty")) {
285
285
  key = key.replace("IsEmpty", "");
286
- condition[key] = { $size: value ? 0 : { $gte: 1 } };
286
+ condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
287
287
  }
288
288
  else {
289
289
  condition[key] = { $in: value };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.303",
3
+ "version": "2.1.305",
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",
@@ -238,7 +238,7 @@ class SearcherFlow<D> {
238
238
  condition[fieldName] = { $exists: value as boolean }
239
239
  } else if (key.endsWith("IsEmpty")) {
240
240
  key = key.replace("IsEmpty", "");
241
- condition[key] = { $size: value ? 0 : { $gte: 1 } };
241
+ condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
242
242
  } else {
243
243
  if (this.model?.schema?.paths[key]?.instance === 'Array') {
244
244
  if (!Array.isArray(value)) {
@@ -259,7 +259,7 @@ class SearcherFlow<D> {
259
259
  condition[key] = { $nin: value };
260
260
  } else if (key.endsWith("IsEmpty")) {
261
261
  key = key.replace("IsEmpty", "");
262
- condition[key] = { $size: value ? 0 : { $gte: 1 } };
262
+ condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
263
263
  } else {
264
264
  condition[key] = { $in: value };
265
265
  }