Available in: Redis Stack
Time complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key
Toggle a boolean value stored at path
.
return
[] element for JSON values matching the path which are not boolean.
redis> JSON.SET doc $ '{"bool": true}'
OK
redis> JSON.TOGGLE doc $.bool
1) (integer) 0
redis> JSON.GET doc $
"[{\"bool\":false}]"
redis> JSON.TOGGLE doc $.bool
1) (integer) 1
redis> JSON.GET doc $
"[{\"bool\":true}]"