c2-mongoose 2.1.312 → 2.1.313

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.
@@ -247,6 +247,10 @@ var SearcherFlow = /** @class */ (function () {
247
247
  key = key.replace("IsEmpty", "");
248
248
  condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
249
249
  }
250
+ else if (key.endsWith("AtLeastOne")) {
251
+ key = key.replace("AtLeastOne", "");
252
+ condition[key] = { $elemMatch: value };
253
+ }
250
254
  else {
251
255
  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') {
252
256
  if (!Array.isArray(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.312",
3
+ "version": "2.1.313",
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,6 +222,9 @@ class SearcherFlow<D> {
222
222
  } else if (key.endsWith("IsEmpty")) {
223
223
  key = key.replace("IsEmpty", "");
224
224
  condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
225
+ } else if (key.endsWith("AtLeastOne")) {
226
+ key = key.replace("AtLeastOne", "");
227
+ condition[key] = { $elemMatch: value }
225
228
  } else {
226
229
  if (this.model?.schema?.paths[key]?.instance === 'Array') {
227
230
  if (!Array.isArray(value)) {