JSON.NUMINCRBY

Syntax
JSON.NUMINCRBY key path value
Available in:
Redis Open Source / 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
ACL categories:
@json, @write, @slow,

Increment the number value stored at path by number

Examples

Required arguments

key

is key to modify.

path

is JSONPath to specify.

value

is number value to increment.

Examples

Increment number values

Create a document.

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

Increment a value of a object by 2. The command fails to find a number and returns null.

redis> JSON.NUMINCRBY doc $.a 2
"[null]"

Recursively find and increment a value of all a objects. The command increments numbers it finds and returns null for nonnumber values.

redis> JSON.NUMINCRBY doc $..a 2
"[null,4,7,null]"

Return information

With $-based path argument: Bulk string reply containing a JSON-encoded string with the new value(s), or null reply if the matching value is not a number.

With .-based path argument: Bulk string reply representing the stringified new value, null reply if the matching value is not a number, or simple error reply on error.

See also

JSON.ARRINDEX | JSON.ARRINSERT

RATE THIS PAGE
Back to top ↑
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy