c2-mongoose 2.1.302 → 2.1.303
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.
|
@@ -259,6 +259,10 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
259
259
|
var fieldName = key.replace('Exists', '');
|
|
260
260
|
condition[fieldName] = { $exists: value };
|
|
261
261
|
}
|
|
262
|
+
else if (key.endsWith("IsEmpty")) {
|
|
263
|
+
key = key.replace("IsEmpty", "");
|
|
264
|
+
condition[key] = { $size: value ? 0 : { $gte: 1 } };
|
|
265
|
+
}
|
|
262
266
|
else {
|
|
263
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') {
|
|
264
268
|
if (!Array.isArray(value)) {
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -236,6 +236,9 @@ class SearcherFlow<D> {
|
|
|
236
236
|
} else if (key.endsWith('Exists')) {
|
|
237
237
|
var fieldName = key.replace('Exists', '')
|
|
238
238
|
condition[fieldName] = { $exists: value as boolean }
|
|
239
|
+
} else if (key.endsWith("IsEmpty")) {
|
|
240
|
+
key = key.replace("IsEmpty", "");
|
|
241
|
+
condition[key] = { $size: value ? 0 : { $gte: 1 } };
|
|
239
242
|
} else {
|
|
240
243
|
if (this.model?.schema?.paths[key]?.instance === 'Array') {
|
|
241
244
|
if (!Array.isArray(value)) {
|