JSON.ARRPOP
Remove and return an element from the index in the array
Required arguments
is key to modify.
index
path
is JSONPath to specify. Default is root $
.
Return
returns an of bulk string replies for each path, each reply is the popped JSON value, or nil
, if the matching JSON value is not an array. For more information about replies, see Redis serialization protocol specification.
Pop a value from an index and insert a new value
Create two headphone products with maximum sound levels.
dragonfly> JSON.SET key $ '[{"name":"Healthy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[60,70,80]},{"name":"Noisy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[80,90,100,120]}]'
OK
Update the max_level
field of the product: remove an unavailable value and add a newly available value.
1) "80"
Get the updated array.
Now insert a new lowest value.
dragonfly> JSON.ARRINSERT key $[1].max_level 0 85
Get the updated array.
See also
JSON.ARRAPPEND
|