JSON.TOGGLE
JSON.TOGGLE key path
Toggle a Boolean value stored at path
keyis key to modify.
pathis JSONPath to specify. Default is root $.
JSON.TOGGLE returns an array of integer replies for each path, the new value (0 if false or 1 if true), or nil for JSON values matching the path that are not Boolean. For more information about replies, see Redis serialization protocol specification.
pathCreate a JSON document.
127.0.0.1:6379> JSON.SET doc $ '{"bool": true}'
OKToggle the Boolean value.
127.0.0.1:6379> JSON.TOGGLE doc $.bool
1) (integer) 0Get the updated document.
127.0.0.1:6379> JSON.GET doc $
"[{\"bool\":false}]"Toggle the Boolean value.
127.0.0.1:6379> JSON.TOGGLE doc $.bool
1) (integer) 1Get the updated document.
127.0.0.1:6379> JSON.GET doc $
"[{\"bool\":true}]"
© 2006–2022 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
https://redis.io/commands/json.toggle/