Skip to content

Commit 4d1cde0

Browse files
Merge pull request #30 from RedisInsight/ViktarStarastsenka-patch-2
Update hashes.md
2 parents c423005 + 88ff340 commit 4d1cde0

28 files changed

+115
-121
lines changed

src/_scripts/manual.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/ds/hashes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Lists, sets, and sorted sets are great for many use cases, but the hash data typ
22

33
Redis hashes are record types that are structured as name-value pairs. Consider the following example that shows how to create a hash key using the `HSET` command.
44

5-
```redis Create a hash
5+
```redis:[run_confirmation=true] Create a hash
66
HSET bike:1 model Deimos brand Ergonom type "Enduro bikes" price 4972
77
```
88

@@ -22,13 +22,13 @@ HGET bike:1 price
2222

2323
You can update fields in a hash using `HSET` by specifying a subset of its name-value pairs.
2424

25-
```redis Update an existing hash
25+
```redis:[run_confirmation=true] Update an existing hash
2626
HSET bike:1 model "Kraken" price 3000
2727
```
2828

2929
Use the `HDEL` command to delete one or more fields from a hash. Once all fields are removed, the hash key itself will be deleted.
3030

31-
```redis Delete hash fields and keys
31+
```redis:[run_confirmation=true] Delete hash fields and keys
3232
HDEL bike:1 model
3333
HGETALL bike:1
3434
HDEL bike:1 brand type price

src/ds/json/adv-jsonpath.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Only JSONPath will be discussed in this tutorial.
66
You've already seen several examples of JSONPath in previous parts of this tutorial. The next sections will describe JSONPath in more complete detail.
77
Some simple JSON documents will be used to demonstrate JSONPath's features.
88

9-
```redis Load documents
9+
```redis:[run_confirmation=true] Load documents
1010
JSON.SET lit1 $ 5
1111
JSON.SET lit2 $ '"abc"'
1212
JSON.SET lit3 $ true
@@ -56,7 +56,7 @@ JSON.GET obj2 '$.["a"]' // note the use of single quotes in this expression; the
5656

5757
It is possible to use `$` as part of a field name.
5858

59-
```redis Using $ as part of a field name
59+
```redis:[run_confirmation=true] Using $ as part of a field name
6060
JSON.SET d $ '{"$":5, "$$":6}'
6161
JSON.GET d $.$ // returns "[5]"
6262
```

src/ds/json/arrays.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Redis has several commands that allow you to manipulate JSON arrays. Simple documents will be used to demonstrate each command.
22

3-
```redis Create a document
3+
```redis:[run_confirmation=true] Create a document
44
JSON.SET doc $ '{"a": [10, 20, 30, 40, 50]}'
55
```
66

@@ -12,14 +12,14 @@ JSON.ARRLEN doc $.a
1212

1313
- `JSON.ARRAPPEND` - append one or more values to an array:
1414

15-
```redis Append two values to $.a
15+
```redis:[run_confirmation=true] Append two values to $.a
1616
JSON.ARRAPPEND doc $.a 60 '"foo"'
1717
JSON.GET doc $.a
1818
```
1919

2020
- `JSON.ARRPOP` - remove an element from an array:
2121

22-
```redis Remove the last item from $.a
22+
```redis:[run_confirmation=true] Remove the last item from $.a
2323
JSON.ARRPOP doc $.a
2424
JSON.GET doc $.a
2525
```
@@ -30,25 +30,25 @@ For example, `-1` mean the last element and `-2` means the second to last elemen
3030

3131
- `JSON.ARRTRIM` - trim an array so that it contains only the specified inclusive range of elements.
3232

33-
```redis Trim $.a to just the first 3 elements
33+
```redis:[run_confirmation=true] Trim $.a to just the first 3 elements
3434
JSON.ARRTRIM doc $.a 0 2
3535
JSON.GET doc
3636
```
3737

3838
Now, reset doc to it's original value and trim `$.a` to just the last two values:
3939

40-
```redis Re-create the document
40+
```redis:[run_confirmation=true] Re-create the document
4141
JSON.SET doc $ '{"a": [10, 20, 30, 40, 50]}'
4242
```
4343

44-
```redis Trim to the last two values
44+
```redis:[run_confirmation=true] Trim to the last two values
4545
JSON.ARRTRIM doc $.a -2 -1
4646
JSON.GET doc
4747
```
4848

4949
As discussed earlier in this tutorial, `JSON.MERGE` can be used to replace entire arrays.
5050

51-
```redis Replace $.a with a different set of values
51+
```redis:[run_confirmation=true] Replace $.a with a different set of values
5252
JSON.MERGE doc $.a '["a", "b", "c"]'
5353
JSON.GET doc
54-
```
54+
```

src/ds/json/create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Here's a query that creates a JSON document describing a single bike.
44

5-
```redis Create a JSON document
5+
```redis:[run_confirmation=true] Create a JSON document
66
JSON.SET bicycle:1 $ '{
77
"model": "Jigger",
88
"brand": "Velorim",
@@ -49,7 +49,7 @@ JSON.GET bicycle:1 $.addons[0]
4949

5050
You can create multiple documents in a single command using `JSON.MSET`:
5151

52-
```redis Add two more documents using JSON.MGET
52+
```redis:[run_confirmation=true] Add two more documents using JSON.MGET
5353
JSON.MSET "bicycle:2" $ "{\"model\": \"Hillcraft\", \"brand\": \"Bicyk\", \"price\": 1200, \"type\": \"Kids Mountain Bikes\", \"specs\": {\"material\": \"carbon\", \"weight\": \"11\"}, \"description\": \"A light mountain bike for kids.\", \"addons\": [\"reflectors\", \"safety lights\"],\"helmet_included\": false}" "bicycle:3" $ "{\"model\": \"Chook air 5\", \"brand\": \"Nord\", \"price\": 815, \"type\": \"Kids Mountain Bikes\", \"specs\": {\"material\": \"alloy\", \"weight\": \"9.1\"}, \"description\": \"A lighter, more durable mountain bike for six years and older.\", \"addons\": [\"reflectors\", \"safety lights\"],\"helmet_included\": false}"
5454
```
5555

@@ -73,4 +73,4 @@ JSON.STRLEN bicycle:1 $.description
7373
JSON.TYPE bicycle:1 $.helmet_included
7474
```
7575

76-
The `JSON.MERGE` can also be used to create new documents. `JSON.MERGE` will be covered in more detail later in this tutorial.
76+
The `JSON.MERGE` can also be used to create new documents. `JSON.MERGE` will be covered in more detail later in this tutorial.

src/ds/json/modify.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ Here are some examples.
44

55
## Extend documents
66

7-
```redis Add a new name-value pair to an existing document
7+
```redis:[run_confirmation=true] Add a new name-value pair to an existing document
88
JSON.SET bicycle:1 $.newmember '"value"'
99
```
1010

1111
You could also use `JSON.MSET` to create or update multiple documents at the same time. First, delete `$.newmember` from `bicycle:1` using `JSON.DEL`.
1212

13-
```redis Delete $.newmember from bicycle:1
13+
```redis:[run_confirmation=true] Delete $.newmember from bicycle:1
1414
JSON.DEL bicycle:1 $.newmember
1515
```
1616

1717
Next, add `$.newmember` to all three bicycles:
1818

19-
```redis Add a member named newmember too all three bicycles using JSON.MSET
19+
```redis:[run_confirmation=true] Add a member named newmember too all three bicycles using JSON.MSET
2020
JSON.MSET bicycle:1 $.newmember '"value1"' bicycle:2 $.newmember '"value2"' bicycle:3 $.newmember '"value3"'
2121
JSON.MGET bicycle:1 bicycle:2 bicycle:3 $.newmember
2222
```
@@ -26,7 +26,7 @@ JSON.MGET bicycle:1 bicycle:2 bicycle:3 $.newmember
2626
The `JSON.NUMINCRBY` command allows you to perform arithmetic operations on numeric fields of documents.
2727
Use positive numbers to increment and negative numbers to decrement.
2828

29-
```redis Decrease the price of bicycle:1
29+
```redis:[run_confirmation=true] Decrease the price of bicycle:1
3030
JSON.GET bicycle:1 $.price
3131
JSON.NUMINCRBY bicycle:1 $.price -10
3232
JSON.GET bicycle:1 $.price
@@ -35,14 +35,14 @@ JSON.GET bicycle:1 $.price
3535

3636
Appending information to JSON strings is straightforward.
3737

38-
```redis Append a string bicycle:1's model
38+
```redis:[run_confirmation=true] Append a string bicycle:1's model
3939
JSON.STRAPPEND bicycle:1 $.model '"naut"'
4040
JSON.GET bicycle:1 $.model
4141
```
4242

4343
The `JSON.TOGGLE` command can be used to toggle boolean values.
4444

45-
```redis Toggle the value of bicycle:1's helmet_included value
45+
```redis:[run_confirmation=true] Toggle the value of bicycle:1's helmet_included value
4646
JSON.GET bicycle:1 $.helmet_included
4747
JSON.TOGGLE bicycle:1 $.helmet_included
4848
JSON.GET bicycle:1 $.helmet_included
@@ -54,28 +54,28 @@ As you saw earlier, the `JSON.MERGE` command can be used to create new documents
5454

5555
- Create a non-existant path-value:
5656

57-
```redis Add a new name-value pair to bicycle:1
57+
```redis:[run_confirmation=true] Add a new name-value pair to bicycle:1
5858
JSON.MERGE bicycle:1 $.newmember2 '"value 2 1"'
5959
JSON.GET bicycle:1
6060
```
6161

6262
- Replace an existing value:
6363

64-
```redis Change bicycle:1's model back to Jigger
64+
```redis:[run_confirmation=true] Change bicycle:1's model back to Jigger
6565
JSON.MERGE bicycle:1 $.model '"Jigger"'
6666
JSON.GET bicycle:1 $.model
6767
```
6868

6969
- Delete an existing value:
7070

71-
```redis Delete newmember2 from bicycle:1
71+
```redis:[run_confirmation=true] Delete newmember2 from bicycle:1
7272
JSON.MERGE bicycle:1 $ '{"newmember2": null}'
7373
JSON.GET bicycle:1
7474
```
7575

7676
- Replace an array:
7777

78-
```redis Replace bicycle:1's addons
78+
```redis:[run_confirmation=true] Replace bicycle:1's addons
7979
JSON.MERGE bicycle:1 $.addons '["reflectors", "rainbow seat"]'
8080
JSON.GET bicycle:1 $.addons
8181
```
@@ -86,17 +86,17 @@ JSON.GET bicycle:1 $.addons
8686

8787
You can delete name-value pairs using the `JSON.DEL` or `JSON.FORGET` commands:
8888

89-
```redis Delete newmember from bicycle:1
89+
```redis:[run_confirmation=true] Delete newmember from bicycle:1
9090
JSON.DEL bicycle:1 $.newmember
9191
JSON.GET bicycle:1
9292
```
9393

9494
The `JSON.CLEAR` command will empty all arrays and set all numeric values to zero. A simple example will illustrate how this works.
9595

96-
```redis JSON.CLEAR usage
96+
```redis:[run_confirmation=true] JSON.CLEAR usage
9797
JSON.SET doc $ '{"obj":{"a":1, "b":2}, "arr":[1,2,3], "str": "foo", "bool": true, "int": 42, "float": 3.14}'
9898
JSON.CLEAR doc $.*
9999
JSON.GET doc $
100100
```
101101

102-
As with all Redis keys, you can use the `DEL` command to delete keys entirely.
102+
As with all Redis keys, you can use the `DEL` command to delete keys entirely.

src/ds/json/more-adv-jsonpath.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
In this section of the JSONPath tutorial, filter and deep scan expressions will be presented using a set of simple documents.
22

3-
```redis Load documents
3+
```redis:[run_confirmation=true] Load documents
44
JSON.SET lit1 $ 5
55
JSON.SET lit2 $ '"abc"'
66
JSON.SET lit3 $ true
@@ -148,4 +148,4 @@ JSON.GET obj2 '$.a[?(@==true)]' // "[true]", Boolean literal
148148
JSON.GET obj2 '$.a[?(@==false)]' // "[false]", Boolean literal
149149
JSON.GET obj2 '$.a[?(@.b==null)]' // "[{\"b\":null}]", nil literal
150150
JSON.GET obj2 '$.a[*].*[?(@==null)]' // "[null]", nil literal
151-
```
151+
```

src/ds/json/objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Redis provides two commands that operate specifically on JSON objects. A simple document will be used to demonstrate each of the two commands.
22

3-
```redis Create document
3+
```redis:[run_confirmation=true] Create document
44
JSON.SET doc $ '{"a":1,"b":2,"o":{"c":3,"d":4}}'
55
```
66

src/ds/lists.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ If a key's values are removed entirely, the key will be removed from the keyspac
2222

2323
In the following example, a list key is created and then a second element is added to it using the `RPUSH` command. The length of the list is returned after each command.
2424

25-
```redis Create a list with two elements
25+
```redis:[run_confirmation=true] Create a list with two elements
2626
RPUSH bike:colors "Blue"
2727
RPUSH bike:colors "White"
2828
```
2929

3030
Next, an element is added to the beginning of the list.
3131

32-
```redis Prepend a new element
32+
```redis:[run_confirmation=true] Prepend a new element
3333
LPUSH bike:colors "Red"
3434
```
3535

3636
When creating a list, there's a shortcut to the above examples. Both `LPUSH` and `RPUSH` accept a variable number of arguments (variadic), so you can create the entire list with a single command. The number of added elements is returned.
3737

38-
```redis Add multiple elements
38+
```redis:[run_confirmation=true] Add multiple elements
3939
DEL bike:colors
4040
RPUSH bike:colors "Red" "Blue" "White" "Yellow"
4141
```
@@ -65,7 +65,7 @@ The `LPOP` and `RPOP` commands will remove and return one or more elements from
6565

6666
In this next example, you will remove a single element from the beginning of the list, then a single element from the end of the list, and, finally, the remaining items using a `count` argument.
6767

68-
```redis LPOP/RPOP usage
68+
```redis:[run_confirmation=true] LPOP/RPOP usage
6969
LPOP bike:colors
7070
LRANGE bike:colors 0 -1
7171
RPOP bike:colors

src/ds/prob/bloom-cuckoo.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Another use case is targeting ads to users. A per-user Bloom filter can be creat
1818
First, create a bloom filter and configure an acceptable false positive rate for your use case.
1919
You can also specify an initial capacity; the size of the dataset that you expect to add to the filter. Bloom filters can be configured to expand when this capacity is reached - [see the `BF.RESERVE` documentation for details](https://redis.io/commands/bf.reserve/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials).
2020

21-
```redis Create a Bloom filter
21+
```redis:[run_confirmation=true] Create a Bloom filter
2222
BF.RESERVE user:778:bought_products 0.001 50 // create new bloom filter at key "user:778:bought_products" with a desired false positive rate of 0.1% (0.001) and anticipated data set size of 50 entries
2323
```
2424

2525
Next, add some products for user 778.
2626

27-
```redis Add all bought product IDs to a Bloom filter
27+
```redis:[run_confirmation=true] Add all bought product IDs to a Bloom filter
2828
BF.MADD user:778:bought_products 4545667 9026875 3178945 4848754 1242449 // Add five items to user 778's list
2929
```
3030

@@ -44,7 +44,7 @@ BF.INFO user:778:bought_products // returns information about the bloom filter a
4444

4545
Inserting items into a Bloom filter that doesn't yet exist will create the filter for you.
4646

47-
```redis Create and add items simultaneously
47+
```redis:[run_confirmation=true] Create and add items simultaneously
4848
BF.INSERT bloomFilter ITEMS foo bar baz // creates the "bloomFilter" key and adds three items to it, if the filter does not already exist
4949
BF.INSERT newBloomFilter CAPACITY 10000 ITEMS hello waves goodbye // creates the "newBloomFilter" key and adds three items to it, if the filter does not already exist
5050
BF.INSERT bloomF NOCREATE ITEMS foo bar // tries to add 2 items to a filter with an error if the filter does not already exist
@@ -58,7 +58,7 @@ You can read more about Bloom filters and their use cases [here](https://redis.i
5858

5959
To begin, create a cuckoo filter with estimated capacity, defined bucket size (the number of items in each bucket), and maximum number of iterations (number of attempts to swap items between buckets).
6060

61-
```redis Create a cuckoo filter
61+
```redis:[run_confirmation=true] Create a cuckoo filter
6262
CF.RESERVE bikes:models 100 BUCKETSIZE 10 MAXITERATIONS 2 // creates a “cuckoo” filter for the initial amount of 100 items, 10 items per bucket and 2 iterations to swap items before creating an additional filter
6363
```
6464

@@ -68,7 +68,7 @@ CF.RESERVE bikes:models 100 BUCKETSIZE 10 MAXITERATIONS 2 // creates a “cuckoo
6868
Next, add items to the cuckoo filter.
6969
Note that `CF.ADD` creates a new filter if one doesn't already exist.
7070

71-
```redis Add Items
71+
```redis:[run_confirmation=true] Add Items
7272
CF.ADD bikes:models "Smokey Mountain Striker"
7373
CF.ADD bikes:models "Cloudy City Cruiser"
7474
CF.ADD bikes:models "Rocky Mountain Racer"
@@ -84,7 +84,7 @@ CF.EXISTS bikes:models "Non-existant model" // returns “0”, the item certain
8484

8585
Cuckoo filters support deletion. Here's an example.
8686

87-
```redis Delete an item
87+
```redis:[run_confirmation=true] Delete an item
8888
CF.DEL bikes:models "Smokey Mountain Striker" // delete the "Smokey Mountain Striker" item once from the filter
8989
```
9090

0 commit comments

Comments
 (0)