JSON.ARRAPPEND
Syntax
JSON.ARRAPPEND key [path] value [value ...]
- Available in:
- Redis Stack / JSON 1.0.0
- 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
Append the json
values into the array at path
after the last element in it.
Return
Array reply of Integer reply - for each path, the array's new size, or Null reply if the matching JSON value is not an array.
Examples
redis> JSON.SET doc $ '{"a":[1], "nested": {"a": [1,2]}, "nested2": {"a": 42}}'
OK
redis> JSON.ARRAPPEND doc $..a 3 4
1) (integer) 3
2) (integer) 4
3) (nil)
redis> JSON.GET doc $
"[{\"a\":[1,3,4],\"nested\":{\"a\":[1,2,3,4]},\"nested2\":{\"a\":42}}]"
Feedback
If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.