Skip to content

Latest commit

 

History

History
67 lines (40 loc) · 1.26 KB

json.del.md

File metadata and controls

67 lines (40 loc) · 1.26 KB

Delete a value

Examples

Required arguments

key

is key to modify.

Optional arguments

path

is JSONPath to specify. Default is root $. Nonexisting paths are ignored.

{{% alert title="Note" color="warning" %}}

Deleting an object's root is equivalent to deleting the key from Redis.

{{% /alert %}}

Return

JSON.DEL returns an integer reply specified as the number of paths deleted (0 or more). For more information about replies, see Redis serialization protocol specification.

Examples

Delete a value

Create a JSON document.

{{< highlight bash >}} 127.0.0.1:6379> JSON.SET doc $ '{"a": 1, "nested": {"a": 2, "b": 3}}' OK {{< / highlight >}}

Delete specified values.

{{< highlight bash >}} 127.0.0.1:6379> JSON.DEL doc $..a (integer) 2 {{< / highlight >}}

Get the updated document.

{{< highlight bash >}} 127.0.0.1:6379> JSON.GET doc $ "[{"nested":{"b":3}}]" {{< / highlight >}}

See also

JSON.SET | JSON.ARRLEN

Related topics