JSON.NUMINCRBY

Since 1.1.0JSON

Syntax

JSON.NUMINCRBY key path number
  • Flags: write
  • ACL categories: @json, @slow, @write
  • Arity: -2

Adds number to each number path matches. A result that is not a finite number fails the command, and nothing changes.

Reply

  • A JSONPath: the new values, as one JSON array in a bulk string, with null where a match is not a number. In RESP3, an array of numbers.
  • A legacy path: the one new value.

Examples

> JSON.SET d $ '{"name":"Ada","age":36}'
OK
> JSON.NUMINCRBY d $.age 2
"[38]"
> JSON.NUMINCRBY d .age 1
"39"
> JSON.NUMINCRBY d $.name 1
"[null]"