Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert / update nested arrays with >1 entries failes #225

Closed
MR4online opened this issue Jan 18, 2024 · 1 comment
Closed

insert / update nested arrays with >1 entries failes #225

MR4online opened this issue Jan 18, 2024 · 1 comment

Comments

@MR4online
Copy link

Versions:

"redis": "^4.6.10",
"redis-om": "^0.4.3"

Schema Definition:

const AppModel = new Schema("app", {
    uuid: { type: "string" },
    ...
    domain: { type: "string", path: "$.config.domains[*].domain", indexed: false },
    returnPathDomain: { type: "string", path: "$.config.domains[*].returnPathDomain", indexed: false },
});

Save (insert & update) Requests with 1 entry work:

{
    "uuid": "73e3d997-1ef8-4afe-955d-311050fad873",
    "config": {
        "domains": [
            {
                "domain": "test.io"
            }
        ]
    }
}

Save (insert & update) Requests with >1 entries DONT work:

{
    "uuid": "73e3d997-1ef8-4afe-955d-311050fad873",
    "config": {
        "domains": [
            {
                "domain": "test.io"
            },
            {
                "domain": "foo.io"
            }
        ]
    }
}

It results in the folllowing Error:
InvalidJsonInput [Error]: Unexpected value for field 'domain' of type 'string' in JSON at '$.config.domains[].domain'.*

I think the definition is correct, because it works with 1 entry perfektly. Looks good in RedisInsight and when reading the data again.
Bildschirmfoto 2024-01-18 um 16 46 25

@MR4online
Copy link
Author

Solved with #209

Domain must be typed as Array:

domain: { type: "string[]", path: "$.config.domains[*].domain", indexed: false },

@MR4online MR4online changed the title Bug: insert / update nested arrays with >1 entries failes insert / update nested arrays with >1 entries failes Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant