c2-mongoose 2.1.314 → 2.1.315
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.
|
@@ -250,12 +250,12 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
250
250
|
}
|
|
251
251
|
else if (key.endsWith("AtLeastOneExists")) {
|
|
252
252
|
key = key.replace("AtLeastOneExists", "");
|
|
253
|
-
var
|
|
254
|
-
if (!
|
|
253
|
+
var fields = key.split('.');
|
|
254
|
+
if (!fields)
|
|
255
255
|
return condition;
|
|
256
256
|
// const elemMatch = {} as any
|
|
257
257
|
// elemMatch[lastField] = value as boolean
|
|
258
|
-
condition[
|
|
258
|
+
condition[fields[0]] = { $elemMatch: (_a = {}, _a[fields[1]] = value, _a) };
|
|
259
259
|
}
|
|
260
260
|
else {
|
|
261
261
|
if (((_d = (_c = (_b = this.model) === null || _b === void 0 ? void 0 : _b.schema) === null || _c === void 0 ? void 0 : _c.paths[key]) === null || _d === void 0 ? void 0 : _d.instance) === 'Array') {
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -225,12 +225,12 @@ class SearcherFlow<D> {
|
|
|
225
225
|
} else if (key.endsWith("AtLeastOneExists")) {
|
|
226
226
|
key = key.replace("AtLeastOneExists", "");
|
|
227
227
|
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
228
|
+
const fields = key.split('.')
|
|
229
|
+
if (!fields) return condition;
|
|
230
230
|
|
|
231
231
|
// const elemMatch = {} as any
|
|
232
232
|
// elemMatch[lastField] = value as boolean
|
|
233
|
-
condition[
|
|
233
|
+
condition[fields[0]] = { $elemMatch: { [fields[1]]: value as boolean} }
|
|
234
234
|
} else {
|
|
235
235
|
if (this.model?.schema?.paths[key]?.instance === 'Array') {
|
|
236
236
|
if (!Array.isArray(value)) {
|