JSON.MSET

Syntax

  1. JSON.MSET key path value [key path value ...]

Time complexity: O(K*(M+N)) where K is the aggregate of all matching paths for the provided keys, M is the size of the original value, and N is the size of the new value.

ACL categories: @json

Atomically sets the JSON value in each node identified by applying the path argument to a JSON object for each key. If $ is used as the path, the entire object is overwritten or created with the provided value.

Examples

Return

JSON.MSET returns “OK” in case of success, or error otherwise.

Examples

  1. dragonfly> JSON.MSET key1 $ '{"a":1}' key2 $ '{"b": 2}'
  2. OK
  3. dragonfly> JSON.GET key1 $
  4. "[{\"a\":1}]"
  5. dragonfly> JSON.MSET key1 $.c 2
  6. OK
  7. dragonfly> JSON.GET key1 $
  8. "[{\"a\":1,\"c\":2}]"

See also

JSON.MSET | JSON.SET