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

JSON.SET cant add a new field #2176

Closed
1 of 2 tasks
superikw opened this issue Mar 18, 2024 · 3 comments · Fixed by #2178
Closed
1 of 2 tasks

JSON.SET cant add a new field #2176

superikw opened this issue Mar 18, 2024 · 3 comments · Fixed by #2178
Labels
bug type bug

Comments

@superikw
Copy link

superikw commented Mar 18, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.7.0 & 2.8.0

Minimal reproduce step

redis> JSON.SET doc $ '{"a":2}'
OK
redis> JSON.SET doc $.b '8'
OK
redis> JSON.GET doc $
"[{"a":2}]"

What did you expect to see?

"[{"a":2,"b":8}]"

What did you see instead?

"[{"a":2}]"

Anything Else?

Example comes from https://redis.io/commands/json.set/

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@superikw superikw added the bug type bug label Mar 18, 2024
@PragmaTwice
Copy link
Member

Yeah it is an known issue. Currently Kvrocks doesn't support set value for a nonexistant path.

Current a workaround is to retrieve the full object and then set the field.

I'll try to fix it soon.

@PragmaTwice
Copy link
Member

It will be fixed in #2178.

Although it's not a perfect fix since we're waiting for support in the underlying library jsoncons, it can work for most scenarios.

@superikw
Copy link
Author

Thanks for your work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants