fix(smartdata.classes.doc): Fix issue with array handling in convertFilterForMongoDb function
This commit is contained in:
parent
4c2477c269
commit
0105aa2a18
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-09-05 - 5.2.10 - fix(smartdata.classes.doc)
|
||||||
|
Fix issue with array handling in convertFilterForMongoDb function
|
||||||
|
|
||||||
|
- Corrected the logic to properly handle array filters in the convertFilterForMongoDb function to avoid incorrect assignments.
|
||||||
|
|
||||||
## 2024-09-05 - 5.2.9 - fix(smartdata.classes.doc)
|
## 2024-09-05 - 5.2.9 - fix(smartdata.classes.doc)
|
||||||
Fixed issue with convertFilterForMongoDb to handle array operators.
|
Fixed issue with convertFilterForMongoDb to handle array operators.
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartdata',
|
name: '@push.rocks/smartdata',
|
||||||
version: '5.2.9',
|
version: '5.2.10',
|
||||||
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
|
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ export const convertFilterForMongoDb = (filterArg: { [key: string]: any }) => {
|
|||||||
const convertFilterArgument = (keyPathArg2: string, filterArg2: any) => {
|
const convertFilterArgument = (keyPathArg2: string, filterArg2: any) => {
|
||||||
if (Array.isArray(filterArg2)) {
|
if (Array.isArray(filterArg2)) {
|
||||||
// Directly assign arrays (they might be using operators like $in or $all)
|
// Directly assign arrays (they might be using operators like $in or $all)
|
||||||
convertedFilter[keyPathArg2] = filterArg2;
|
convertFilterArgument(keyPathArg2, filterArg2[0]);
|
||||||
} else if (typeof filterArg2 === 'object' && filterArg2 !== null) {
|
} else if (typeof filterArg2 === 'object' && filterArg2 !== null) {
|
||||||
for (const key of Object.keys(filterArg2)) {
|
for (const key of Object.keys(filterArg2)) {
|
||||||
if (key.startsWith('$')) {
|
if (key.startsWith('$')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user