JSON.NUMINCRBY key path value

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

Increments the number value stored at path by number.

Return

[] if the matching JSON value is not a number.

Examples

redis> JSON.SET doc . '{"a":"b","b":[{"a":2}, {"a":5}, {"a":"c"}]}'
OK
redis> JSON.NUMINCRBY doc $.a 2
"[null]"
redis> JSON.NUMINCRBY doc $..a 2
"[null,4,7,null]"