JSON.NUMMULTBY

JSON.NUMMULTBY 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,
Compatibility:
Redis Software and Redis Cloud compatibility

Multiply the number value stored at path by value

Examples

Required arguments

key

is key to modify.

path

is JSONPath to specify.

value

is number value to multiply.

Examples

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

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Supported
✅ Flexible & Annual
✅ Free & Fixed

Return information

With $-based path argument: Bulk string reply containing a JSON array with one element per matching path: the new value, or null if the matching value is not a number. The array is empty if no path matches.

With .-based path argument: Bulk string reply representing the stringified new value. If the path matches more than one number, the command updates all of them and returns the last new value. Simple error reply if no matching value is a number.

With either path argument: simple error reply if the key doesn't exist or the result is out of range.

See also

JSON.NUMINCRBY | JSON.ARRINSERT

RATE THIS PAGE
Back to top ↑