You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
json.set After what can consolidation be supported? #618
JSON.SET updates a value at a given path, if the path already exists. JSON.SET also adds a new immediate child, if the path to the parent already exists.
For example,
127.0.0.1:6379> json.set a $ '{"name":"abcd","age":1}'
OK
127.0.0.1:6379> json.get a $
"[{\"name\":\"abcd\",\"age\":1}]"
Adding a new immediate child
127.0.0.1:6379> json.set a $.type '1'
OK
127.0.0.1:6379> json.get a $
"[{\"name\":\"abcd\",\"age\":1,\"type\":1}]"
Updating existing value
127.0.0.1:6379> json.set a $.type '2'
OK
127.0.0.1:6379> json.get a $
"[{\"name\":\"abcd\",\"age\":1,\"type\":2}]"
Adding more children
127.0.0.1:6379> json.set a $.new_arr '[1,2,3]'
OK
127.0.0.1:6379> json.get a $
"[{\"name\":\"abcd\",\"age\":1,\"type\":2,\"new_arr\":[1,2,3]}]"
127.0.0.1:6379> json.set a $.new_obj '{"level2":{"name":"xyz"}}'
OK
127.0.0.1:6379> json.get a $
"[{\"name\":\"abcd\",\"age\":1,\"type\":2,\"new_arr\":[1,2,3],\"new_obj\":{\"level2\":{\"name\":\"xyz\"}}}]"
127.0.0.1:6379>
See json.set documentation on NX and XX flags for more controlled consolidation.
Activity
oshadmi commentedon Jan 14, 2022
JSON.SETupdates a value at a given path, if the path already exists.JSON.SETalso adds a new immediate child, if the path to the parent already exists.For example,
Adding a new immediate child
Updating existing value
Adding more children
See
json.setdocumentation onNXandXXflags for more controlled consolidation.501956430 commentedon Jan 17, 2022
@oshadmi thank you I hope it can be added to the document