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

update error when use nested properties and setTo #404

Open
WankkoRee opened this issue Mar 12, 2023 · 0 comments
Open

update error when use nested properties and setTo #404

WankkoRee opened this issue Mar 12, 2023 · 0 comments
Labels

Comments

@WankkoRee
Copy link

WankkoRee commented Mar 12, 2023

follow the docs: https://litote.org/kmongo/typed-queries/#update, i write these code:

data class Parent (
    val child Child,
) {
    data class Child (
        val name String,
    )
}

col.updateOne(..., Parent::child / Parent.Child::name setTo "test")// code 1.
col.updateOne(..., (Parent::child / Parent.Child::name) setTo "test")// code 2.
col.updateOne(..., (Parent::child / Parent.Child::name).setTo("test"))// code 3.
col.updateOne(..., set(Parent::child / Parent.Child::name setTo "test"))// code 4.
col.updateOne(..., setValue(Parent::child / Parent.Child::name, "test"))// code 5.

if use code 1/2/3, the docs will be:

{
    "child": {
        "name": ""
    },
    "property": "$child.name",
    "value": "test"
}

if use code 4/5, the docs will be:

{
    "child": {
        "name": "test"
    }
}

so if use setTo with nested properties, i also need to use set?

@zigzago zigzago added the bug label Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants