I have a JSON stored in redis. I wanted to update two of its value using a where condition for same key. I am able to update for a single attribute, but how to update two attributes?
JSON.SET TDSS "$.accounts[?(@.Code == 'abc')].feeAdj[0].feeAmount" "\"1000\""
This is working fine for single value updates.
How can I update two values in JSON with condition of Code == 'abc'
?
I tried JSON.MSET
, it is not working properly.
Yes, you can do that:
Let's start with retrieving the values of two elements:
Now, let's change the values of these two elements:
And retrieve the values of these two elements again:
Note that JSON.MERGE is available since Redis Stack 7.2.