JSON.MGET

Syntax

  1. JSON.MGET key [key ...] path

Time complexity: O(M*N) when path is evaluated to a single value where M is the number of keys and N is the size of the value, O(N1+N2+…+Nm) when path is evaluated to multiple values where m is the number of keys and Ni is the size of the i-th key

ACL categories: @json

Return the values at path from multiple key arguments

Examples

Required arguments

key

is key to parse. Returns null for nonexistent keys.

Optional arguments

path

is JSONPath to specify. Default is root $. Returns null for nonexistent paths.

Return

JSON.MGET returns an array of bulk string replies specified as the JSON serialization of the value at each key’s path. For more information about replies, see Redis serialization protocol specification.

Examples

Return the values at path from multiple key arguments

Create two JSON documents.

  1. dragonfly> JSON.SET doc1 $ '{"a":1, "b": 2, "nested": {"a": 3}, "c": null}'
  2. OK
  3. dragonfly> JSON.SET doc2 $ '{"a":4, "b": 5, "nested": {"a": 6}, "c": null}'
  4. OK

Get values from all arguments in the documents.

  1. dragonfly> JSON.MGET doc1 doc2 $..a
  2. 1) "[1,3]"
  3. 2) "[4,6]"

See also

JSON.SET | JSON.GET