c2-mongoose 2.1.316 → 2.1.317

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.
@@ -245,9 +245,7 @@ var SearcherFlow = /** @class */ (function () {
245
245
  var fields = key.split('.');
246
246
  if (!fields)
247
247
  return condition;
248
- // const elemMatch = {} as any
249
- // elemMatch[lastField] = value as boolean
250
- condition[fields[0]] = { $elemMatch: (_a = {}, _a[fields[1]] = value, _a) };
248
+ condition[fields[0]] = { $elemMatch: (_a = {}, _a[fields[1]] = { $exists: value }, _a) };
251
249
  }
252
250
  else if (key.endsWith('Exists')) {
253
251
  var fieldName = key.replace('Exists', '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.316",
3
+ "version": "2.1.317",
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",
@@ -222,9 +222,7 @@ class SearcherFlow<D> {
222
222
  const fields = key.split('.')
223
223
  if (!fields) return condition;
224
224
 
225
- // const elemMatch = {} as any
226
- // elemMatch[lastField] = value as boolean
227
- condition[fields[0]] = { $elemMatch: { [fields[1]]: value as boolean } }
225
+ condition[fields[0]] = { $elemMatch: { [fields[1]]: { $exists: value as boolean } } }
228
226
  } else if (key.endsWith('Exists')) {
229
227
  var fieldName = key.replace('Exists', '')
230
228
  condition[fieldName] = { $exists: value as boolean }