c2-mongoose 2.1.186 → 2.1.188

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.
@@ -498,8 +498,8 @@ var SearchFlow = /** @class */ (function () {
498
498
  condition[fieldName] = _this.buildRegex(value); //{ $regex: value as any, $options: 'i' }
499
499
  filters.$and.push(condition);
500
500
  }
501
- else if (key.endsWith('NotExist')) {
502
- var fieldName = key.replace('NotExist', '');
501
+ else if (key.endsWith('Exists')) {
502
+ var fieldName = key.replace('Exists', '');
503
503
  condition[fieldName] = { $exists: value };
504
504
  filters.$and.push(condition);
505
505
  }
@@ -14,7 +14,7 @@ var isEmpty = function (obj) {
14
14
  if (obj === null) {
15
15
  return true;
16
16
  }
17
- if (!obj) {
17
+ if (!obj && obj !== false) {
18
18
  return true;
19
19
  }
20
20
  if (Array.isArray(obj)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.186",
3
+ "version": "2.1.188",
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",
@@ -447,8 +447,8 @@ abstract class SearchFlow {
447
447
  var fieldName = key.replace('Like', '')
448
448
  condition[fieldName] = this.buildRegex(value as string) //{ $regex: value as any, $options: 'i' }
449
449
  filters.$and.push(condition)
450
- } else if (key.endsWith('NotExist')) {
451
- var fieldName = key.replace('NotExist', '')
450
+ } else if (key.endsWith('Exists')) {
451
+ var fieldName = key.replace('Exists', '')
452
452
  condition[fieldName] = { $exists: value as boolean }
453
453
  filters.$and.push(condition)
454
454
  }
@@ -14,7 +14,7 @@ export const isEmpty = (obj: any) => {
14
14
  if (obj === null) {
15
15
  return true
16
16
  }
17
- if (!obj) {
17
+ if (!obj && obj !== false) {
18
18
  return true
19
19
  }
20
20