my-q-format-response-aws-lambda 2.0.15 → 2.0.16
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.
- package/index.js +10 -3
- package/index.ts +8 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -478,9 +478,16 @@ const normaliseMongoFilter = (filter, regexFields, excludeFields) => {
|
|
|
478
478
|
v === Infinity ||
|
|
479
479
|
v === undefined ||
|
|
480
480
|
excludeParams.includes(f))) {
|
|
481
|
-
|
|
482
|
-
if (
|
|
483
|
-
|
|
481
|
+
// Handle *In fields as MongoDB $in operator
|
|
482
|
+
if (f.endsWith('In') && Array.isArray(v)) {
|
|
483
|
+
const mongoField = f.slice(0, -2);
|
|
484
|
+
_filter[mongoField] = { $in: v.filter((item) => item !== null && item !== undefined) };
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
_filter[f] = filter[f];
|
|
488
|
+
if (regexFields.includes(f))
|
|
489
|
+
_filter[f] = { $regex: new RegExp(_filter[f], 'gi') };
|
|
490
|
+
}
|
|
484
491
|
}
|
|
485
492
|
});
|
|
486
493
|
return _filter;
|
package/index.ts
CHANGED
|
@@ -794,9 +794,14 @@ export const normaliseMongoFilter = (
|
|
|
794
794
|
excludeParams.includes(f)
|
|
795
795
|
)
|
|
796
796
|
) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
797
|
+
// Handle *In fields as MongoDB $in operator
|
|
798
|
+
if (f.endsWith('In') && Array.isArray(v)) {
|
|
799
|
+
const mongoField = f.slice(0, -2)
|
|
800
|
+
_filter[mongoField] = { $in: v.filter((item: any) => item !== null && item !== undefined) }
|
|
801
|
+
} else {
|
|
802
|
+
_filter[f] = filter[f]
|
|
803
|
+
if (regexFields.includes(f)) _filter[f] = { $regex: new RegExp(_filter[f], 'gi') }
|
|
804
|
+
}
|
|
800
805
|
}
|
|
801
806
|
})
|
|
802
807
|
|
package/package.json
CHANGED