Skip to content

Commit 950d499

Browse files
authored
Merge pull request RedisJSON#977 from RedisJSON/LiorKogan-patch-1-docs
Update docs
2 parents 6606471 + b547ba2 commit 950d499

20 files changed

+76
-79
lines changed

docs/commands/json.arrappend.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ For more information about replies, see [Redis serialization protocol specificat
3838
Create a document for noise-cancelling headphones in black and silver colors.
3939

4040
{{< highlight bash >}}
41-
127.0.0.1:6379> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
41+
redis> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
4242
OK
4343
{{< / highlight >}}
4444

4545
Add color `blue` to the end of the `colors` array. `JSON.ARRAPEND` returns the array's new size.
4646

4747
{{< highlight bash >}}
48-
127.0.0.1:6379> JSON.ARRAPPEND item:1 $.colors '"blue"'
48+
redis> JSON.ARRAPPEND item:1 $.colors '"blue"'
4949
1) (integer) 3
5050
{{< / highlight >}}
5151

5252
Return the new length of the `colors` array.
5353

5454
{{< highlight bash >}}
55-
127.0.0.1:6379> JSON.GET item:1
55+
redis> JSON.GET item:1
5656
"{\"name\":\"Noise-cancelling Bluetooth headphones\",\"description\":\"Wireless Bluetooth headphones with noise-cancelling technology\",\"connection\":{\"wireless\":true,\"type\":\"Bluetooth\"},\"price\":99.98,\"stock\":25,\"colors\":[\"black\",\"silver\",\"blue\"]}"
5757
{{< / highlight >}}
5858

docs/commands/json.arrindex.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ For more information about replies, see [Redis serialization protocol specificat
5454
Create a document for noise-cancelling headphones in black and silver colors.
5555

5656
{{< highlight bash >}}
57-
127.0.0.1:6379> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
57+
redis> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
5858
OK
5959
{{< / highlight >}}
6060

6161
Add color `blue` to the end of the `colors` array. `JSON.ARRAPEND` returns the array's new size.
6262

6363
{{< highlight bash >}}
64-
127.0.0.1:6379> JSON.ARRAPPEND item:1 $.colors '"blue"'
64+
redis> JSON.ARRAPPEND item:1 $.colors '"blue"'
6565
1) (integer) 3
6666
{{< / highlight >}}
6767

@@ -75,28 +75,28 @@ JSON.GET item:1
7575
Get the list of colors for the product.
7676

7777
{{< highlight bash >}}
78-
127.0.0.1:6379> JSON.GET item:1 '$.colors[*]'
78+
redis> JSON.GET item:1 '$.colors[*]'
7979
"[\"black\",\"silver\",\"blue\"]"
8080
{{< / highlight >}}
8181

8282
Insert two more colors after the second color. You now have five colors.
8383

8484
{{< highlight bash >}}
85-
127.0.0.1:6379> JSON.ARRINSERT item:1 $.colors 2 '"yellow"' '"gold"'
85+
redis> JSON.ARRINSERT item:1 $.colors 2 '"yellow"' '"gold"'
8686
1) (integer) 5
8787
{{< / highlight >}}
8888

8989
Get the updated list of colors.
9090

9191
{{< highlight bash >}}
92-
127.0.0.1:6379> JSON.GET item:1 $.colors
92+
redis> JSON.GET item:1 $.colors
9393
"[[\"black\",\"silver\",\"yellow\",\"gold\",\"blue\"]]"
9494
{{< / highlight >}}
9595

9696
Find the place where color `silver` is located.
9797

9898
{{< highlight bash >}}
99-
127.0.0.1:6379> JSON.ARRINDEX item:1 $..colors '"silver"'
99+
redis> JSON.ARRINDEX item:1 $..colors '"silver"'
100100
1) (integer) 1
101101
{{< / highlight >}}
102102
</details>

docs/commands/json.arrinsert.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ For more information about replies, see [Redis serialization protocol specificat
4343
Create a document for noise-cancelling headphones in black and silver colors.
4444

4545
{{< highlight bash >}}
46-
127.0.0.1:6379> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
46+
redis> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"]}'
4747
OK
4848
{{< / highlight >}}
4949

5050
Add color `blue` to the end of the `colors` array. `JSON.ARRAPEND` returns the array's new size.
5151

5252
{{< highlight bash >}}
53-
127.0.0.1:6379> JSON.ARRAPPEND item:1 $.colors '"blue"'
53+
redis> JSON.ARRAPPEND item:1 $.colors '"blue"'
5454
1) (integer) 3
5555
{{< / highlight >}}
5656

@@ -64,21 +64,21 @@ JSON.GET item:1
6464
Get the list of colors for the product.
6565

6666
{{< highlight bash >}}
67-
127.0.0.1:6379> JSON.GET item:1 '$.colors[*]'
67+
redis> JSON.GET item:1 '$.colors[*]'
6868
"[\"black\",\"silver\",\"blue\"]"
6969
{{< / highlight >}}
7070

7171
Insert two more colors after the second color. You now have five colors.
7272

7373
{{< highlight bash >}}
74-
127.0.0.1:6379> JSON.ARRINSERT item:1 $.colors 2 '"yellow"' '"gold"'
74+
redis> JSON.ARRINSERT item:1 $.colors 2 '"yellow"' '"gold"'
7575
1) (integer) 5
7676
{{< / highlight >}}
7777

7878
Get the updated list of colors.
7979

8080
{{< highlight bash >}}
81-
127.0.0.1:6379> JSON.GET item:1 $.colors
81+
redis> JSON.GET item:1 $.colors
8282
"[[\"black\",\"silver\",\"yellow\",\"gold\",\"blue\"]]"
8383
{{< / highlight >}}
8484
</details>

docs/commands/json.arrlen.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ For more information about replies, see [Redis serialization protocol specificat
2929
Create a document for wireless earbuds.
3030

3131
{{< highlight bash >}}
32-
127.0.0.1:6379> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}'
32+
redis> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}'
3333
OK
3434
{{< / highlight >}}
3535

3636
Find lengths of arrays in all objects of the document.
3737

3838
{{< highlight bash >}}
39-
127.0.0.1:6379> JSON.ARRLEN item:2 '$.[*]'
39+
redis> JSON.ARRLEN item:2 '$.[*]'
4040
1) (nil)
4141
2) (nil)
4242
3) (nil)
@@ -49,14 +49,14 @@ Find lengths of arrays in all objects of the document.
4949
Return the length of the `max_level` array.
5050

5151
{{< highlight bash >}}
52-
127.0.0.1:6379> JSON.ARRLEN item:2 '$..max_level'
52+
redis> JSON.ARRLEN item:2 '$..max_level'
5353
1) (integer) 3
5454
{{< / highlight >}}
5555

5656
Get all the maximum level values.
5757

5858
{{< highlight bash >}}
59-
127.0.0.1:6379> JSON.GET item:2 '$..max_level'
59+
redis> JSON.GET item:2 '$..max_level'
6060
"[[80,100,120]]"
6161
{{< / highlight >}}
6262

docs/commands/json.arrpop.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,42 @@ For more information about replies, see [Redis serialization protocol specificat
3434
Create two headphone products with maximum sound levels.
3535

3636
{{< highlight bash >}}
37-
127.0.0.1:6379> JSON.SET key $ '[{"name":"Healthy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[60,70,80]},{"name":"Noisy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[80,90,100,120]}]'
37+
redis> JSON.SET key $ '[{"name":"Healthy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[60,70,80]},{"name":"Noisy headphones","description":"Wireless Bluetooth headphones with noise-cancelling technology","connection":{"wireless":true,"type":"Bluetooth"},"price":99.98,"stock":25,"colors":["black","silver"],"max_level":[80,90,100,120]}]'
3838
OK
3939
{{< / highlight >}}
4040

4141
Get all maximum values for the second product.
4242

4343
{{< highlight bash >}}
44-
127.0.0.1:6379> JSON.GET key $.[1].max_level
44+
redis> JSON.GET key $.[1].max_level
4545
"[[80,90,100,120]]"
4646
{{< / highlight >}}
4747

4848
Update the `max_level` field of the product: remove an unavailable value and add a newly available value.
4949

5050
{{< highlight bash >}}
51-
127.0.0.1:6379> JSON.ARRPOP key $.[1].max_level 0
51+
redis> JSON.ARRPOP key $.[1].max_level 0
5252
1) "80"
5353
{{< / highlight >}}
5454

5555
Get the updated array.
5656

5757
{{< highlight bash >}}
58-
127.0.0.1:6379> JSON.GET key $.[1].max_level
58+
redis> JSON.GET key $.[1].max_level
5959
"[[90,100,120]]"
6060
{{< / highlight >}}
6161

6262
Now insert a new lowest value.
6363

6464
{{< highlight bash >}}
65-
127.0.0.1:6379> JSON.ARRINSERT key $.[1].max_level 0 85
65+
redis> JSON.ARRINSERT key $.[1].max_level 0 85
6666
1) (integer) 4
6767
{{< / highlight >}}
6868

6969
Get the updated array.
7070

7171
{{< highlight bash >}}
72-
127.0.0.1:6379> JSON.GET key $.[1].max_level
72+
redis> JSON.GET key $.[1].max_level
7373
"[[85,90,100,120]]"
7474
{{< / highlight >}}
7575
</details>

docs/commands/json.arrtrim.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,36 +50,36 @@ For more information about replies, see [Redis serialization protocol specificat
5050
Create two headphone products with maximum sound levels.
5151

5252
{{< highlight bash >}}
53-
127.0.0.1:6379> JSON.GET key $
53+
redis> JSON.GET key $
5454
"[[{\"name\":\"Healthy headphones\",\"description\":\"Wireless Bluetooth headphones with noise-cancelling technology\",\"connection\":{\"wireless\":true,\"type\":\"Bluetooth\"},\"price\":99.98,\"stock\":25,\"colors\":[\"black\",\"silver\"],\"max_level\":[60,70,80]},{\"name\":\"Noisy headphones\",\"description\":\"Wireless Bluetooth headphones with noise-cancelling technology\",\"connection\":{\"wireless\":true,\"type\":\"Bluetooth\"},\"price\":99.98,\"stock\":25,\"colors\":[\"black\",\"silver\"],\"max_level\":[85,90,100,120]}]]"
5555
OK
5656
{{< / highlight >}}
5757

5858
Add new sound level values to the second product.
5959

6060
{{< highlight bash >}}
61-
127.0.0.1:6379> JSON.ARRAPPEND key $.[1].max_level 140 160 180 200 220 240 260 280
61+
redis> JSON.ARRAPPEND key $.[1].max_level 140 160 180 200 220 240 260 280
6262
1) (integer) 12
6363
{{< / highlight >}}
6464

6565
Get the updated array.
6666

6767
{{< highlight bash >}}
68-
127.0.0.1:6379> JSON.GET key $.[1].max_level
68+
redis> JSON.GET key $.[1].max_level
6969
"[[85,90,100,120,140,160,180,200,220,240,260,280]]"
7070
{{< / highlight >}}
7171

7272
Keep only the values between the fifth and the ninth element, inclusive of that last element.
7373

7474
{{< highlight bash >}}
75-
127.0.0.1:6379> JSON.ARRTRIM key $.[1].max_level 4 8
75+
redis> JSON.ARRTRIM key $.[1].max_level 4 8
7676
1) (integer) 5
7777
{{< / highlight >}}
7878

7979
Get the updated array.
8080

8181
{{< highlight bash >}}
82-
127.0.0.1:6379> JSON.GET key $.[1].max_level
82+
redis> JSON.GET key $.[1].max_level
8383
"[[140,160,180,200,220]]"
8484
{{< / highlight >}}
8585
</details>

docs/commands/json.clear.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ Already cleared values are ignored for empty containers and zero numbers.
3535
Create a JSON document.
3636

3737
{{< highlight bash >}}
38-
127.0.0.1:6379> JSON.SET doc $ '{"obj":{"a":1, "b":2}, "arr":[1,2,3], "str": "foo", "bool": true, "int": 42, "float": 3.14}'
38+
redis> JSON.SET doc $ '{"obj":{"a":1, "b":2}, "arr":[1,2,3], "str": "foo", "bool": true, "int": 42, "float": 3.14}'
3939
OK
4040
{{< / highlight >}}
4141

4242
Clear all container values. This returns the number of objects with cleared values.
4343

4444
{{< highlight bash >}}
45-
127.0.0.1:6379> JSON.CLEAR doc $.*
45+
redis> JSON.CLEAR doc $.*
4646
(integer) 4
4747
{{< / highlight >}}
4848

4949
Get the updated document. Note that numeric values have been set to `0`.
5050

5151
{{< highlight bash >}}
52-
127.0.0.1:6379> JSON.GET doc $
52+
redis> JSON.GET doc $
5353
"[{\"obj\":{},\"arr\":[],\"str\":\"foo\",\"bool\":true,\"int\":0,\"float\":0}]"
5454
{{< / highlight >}}
5555
</details>

docs/commands/json.debug-memory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ For more information about replies, see [Redis serialization protocol specificat
2929
Create a JSON document.
3030

3131
{{< highlight bash >}}
32-
127.0.0.1:6379> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}'
32+
redis> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}'
3333
OK
3434
{{< / highlight >}}
3535

3636
Get the values' memory usage in bytes.
3737

3838
{{< highlight bash >}}
39-
127.0.0.1:6379> JSON.DEBUG MEMORY item:2
39+
redis> JSON.DEBUG MEMORY item:2
4040
(integer) 253
4141
{{< / highlight >}}
4242
</details>

docs/commands/json.del.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ For more information about replies, see [Redis serialization protocol specificat
3535
Create a JSON document.
3636

3737
{{< highlight bash >}}
38-
127.0.0.1:6379> JSON.SET doc $ '{"a": 1, "nested": {"a": 2, "b": 3}}'
38+
redis> JSON.SET doc $ '{"a": 1, "nested": {"a": 2, "b": 3}}'
3939
OK
4040
{{< / highlight >}}
4141

4242
Delete specified values.
4343

4444
{{< highlight bash >}}
45-
127.0.0.1:6379> JSON.DEL doc $..a
45+
redis> JSON.DEL doc $..a
4646
(integer) 2
4747
{{< / highlight >}}
4848

4949
Get the updated document.
5050

5151
{{< highlight bash >}}
52-
127.0.0.1:6379> JSON.GET doc $
52+
redis> JSON.GET doc $
5353
"[{\"nested\":{\"b\":3}}]"
5454
{{< / highlight >}}
5555
</details>

docs/commands/json.get.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Produce pretty-formatted JSON with `redis-cli` by following this example:
4949

5050
{{< highlight bash >}}
5151
~/$ redis-cli --raw
52-
127.0.0.1:6379> JSON.GET myjsonkey INDENT "\t" NEWLINE "\n" SPACE " " path.to.value[1]
52+
redis> JSON.GET myjsonkey INDENT "\t" NEWLINE "\n" SPACE " " path.to.value[1]
5353
{{< / highlight >}}
5454

5555
{{% /alert %}}
@@ -70,21 +70,21 @@ For more information about replies, see [Redis serialization protocol specificat
7070
Create a JSON document.
7171

7272
{{< highlight bash >}}
73-
127.0.0.1:6379> JSON.SET doc $ '{"a":2, "b": 3, "nested": {"a": 4, "b": null}}'
73+
redis> JSON.SET doc $ '{"a":2, "b": 3, "nested": {"a": 4, "b": null}}'
7474
OK
7575
{{< / highlight >}}
7676

7777
With a single JSONPath (JSON array bulk string):
7878

7979
{{< highlight bash >}}
80-
127.0.0.1:6379> JSON.GET doc $..b
80+
redis> JSON.GET doc $..b
8181
"[3,null]"
8282
{{< / highlight >}}
8383

8484
Using multiple paths with at least one JSONPath returns a JSON string with a top-level object with an array of JSON values per path:
8585

8686
{{< highlight bash >}}
87-
127.0.0.1:6379> JSON.GET doc ..a $..b
87+
redis> JSON.GET doc ..a $..b
8888
"{\"$..b\":[3,null],\"..a\":[2,4]}"
8989
{{< / highlight >}}
9090
</details>

docs/commands/json.numincrby.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ For more information about replies, see [Redis serialization protocol specificat
3232
Create a document.
3333

3434
{{< highlight bash >}}
35-
127.0.0.1:6379> JSON.SET doc . '{"a":"b","b":[{"a":2}, {"a":5}, {"a":"c"}]}'
35+
redis> JSON.SET doc . '{"a":"b","b":[{"a":2}, {"a":5}, {"a":"c"}]}'
3636
OK
3737
{{< / highlight >}}
3838

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

4141
{{< highlight bash >}}
42-
127.0.0.1:6379> JSON.NUMINCRBY doc $.a 2
42+
redis> JSON.NUMINCRBY doc $.a 2
4343
"[null]"
4444
{{< / highlight >}}
4545

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

4848
{{< highlight bash >}}
49-
127.0.0.1:6379> JSON.NUMINCRBY doc $..a 2
49+
redis> JSON.NUMINCRBY doc $..a 2
5050
"[null,4,7,null]"
5151
{{< / highlight >}}
5252

docs/commands/json.nummultby.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ For more information about replies, see [Redis serialization protocol specificat
2929
## Examples
3030

3131
{{< highlight bash >}}
32-
127.0.0.1:6379> JSON.SET doc . '{"a":"b","b":[{"a":2}, {"a":5}, {"a":"c"}]}'
32+
redis> JSON.SET doc . '{"a":"b","b":[{"a":2}, {"a":5}, {"a":"c"}]}'
3333
OK
34-
127.0.0.1:6379> JSON.NUMMULTBY doc $.a 2
34+
redis> JSON.NUMMULTBY doc $.a 2
3535
"[null]"
36-
127.0.0.1:6379> JSON.NUMMULTBY doc $..a 2
36+
redis> JSON.NUMMULTBY doc $..a 2
3737
"[null,4,10,null]"
3838
{{< / highlight >}}
3939

docs/commands/json.objkeys.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ For more information about replies, see [Redis serialization protocol specificat
2525
## Examples
2626

2727
{{< highlight bash >}}
28-
127.0.0.1:6379> JSON.SET doc $ '{"a":[3], "nested": {"a": {"b":2, "c": 1}}}'
28+
redis> JSON.SET doc $ '{"a":[3], "nested": {"a": {"b":2, "c": 1}}}'
2929
OK
30-
127.0.0.1:6379> JSON.OBJKEYS doc $..a
30+
redis> JSON.OBJKEYS doc $..a
3131
1) (nil)
3232
2) 1) "b"
3333
2) "c"

0 commit comments

Comments
 (0)