Skip to content

Commit 548fd70

Browse files
committed
DOC-3179: apply reviewer comments
1 parent 7190fea commit 548fd70

21 files changed

+116
-127
lines changed

src/ds/hashes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
Lists, sets, and sorted sets are great for many use cases, but the hash data type is on a higher level. Redis hashes are maps (sequences of field-value pairs) and are used to represent objects in Redis. Consider the following example that shows how to create a hash key using the `HSET` command.
22

3+
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.
4+
35
```redis Create a hash
46
HSET bike:1 model Deimos brand Ergonom type "Enduro bikes" price 4972
57
```
68

7-
`HSET` returns the number of added key/value pairs.
9+
`HSET` returns the number of added name-value pairs.
810

911
To retrieve the stored data, use the `HGETALL` command.
1012

1113
```redis HGETALL usage
12-
HGETALL bike:1 // returns all the field-value pairs associated with the key
14+
HGETALL bike:1 // returns all the name-value pairs associated with the key
1315
```
1416

1517
If you only want the values of a subset of the fields, use the `HGET` command.
@@ -18,7 +20,7 @@ If you only want the values of a subset of the fields, use the `HGET` command.
1820
HGET bike:1 price
1921
```
2022

21-
You can update fields in a hash using `HSET` by specifying a subset of its field-value pairs.
23+
You can update fields in a hash using `HSET` by specifying a subset of its name-value pairs.
2224

2325
```redis Update an existing hash
2426
HSET bike:1 model "Kraken" price 3000
@@ -34,14 +36,12 @@ HGETALL bike:1
3436
EXISTS bike:1
3537
```
3638

37-
Numerical values in hash keys can be incremented in the same way as simple string keys using the `HINCRBY` command.
39+
Integer values in hash keys can be incremented or decremented in the same way as simple string keys using the `HINCRBY` command.
40+
The increment value must be a positive or negative integer.
3841

3942
```redis Hash INCRBY usage
4043
HINCRBY bike:1 price 100
4144
HINCRBY bike:1 price -100
4245
```
4346

4447
See [here](https://redis.io/docs/data-types/hashes) for the hash type reference page, and [here](https://redis.io/commands/?group=hash) for the entire set of Redis hash commands.
45-
46-
**Note**:
47-
> If you're more familiar with JSON and want to use it with Redis, there is a [JSON data type](https://redis.io/docs/data-types/json) that is provided as part of Redis Stack. There's also a tutorial titled "Working with JSON" that is bundled with RedisInsight.

src/ds/json/adv-jsonpath.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ JSON.SET arr1 $ [1,2,3]
1717
JSON.SET arrmap $ '[{"a":1}, {"b":2}]'
1818
```
1919

20-
The returned value of a JSONPath expression is a JSON string with a top-level array of JSON serialized strings.
21-
2220
**Note**:
23-
>A JSONPath query can resolve to several locations in a JSON document. When more than one location is identified, the JSON commands apply the operation to every possible location.
21+
>A JSONPath query can resolve to multiple absolute path matches. When more than one matching path is identified, the JSON commands apply the operation to every possible path.
2422
2523
## JSONPath syntax
2624

2725
| Syntax element | Description |
2826
|----------------|-------------|
2927
| `$` | The root (outermost JSON element), starts the path. |
30-
| `.` or `[]` | Selects a child element. |
28+
| `.` | Selects a child element. |
3129
| `..` | Recursively descends through the JSON document. |
32-
| `*` | Wildcard, returns all elements. |
30+
| `*` | If current node is an array, `*` resolves to all array elements. If current node is an object, `*` resolves to all the object's members |
3331
| `[]` | Subscript operator, accesses an array element. |
3432
| `[,]` | Union, selects multiple elements. |
3533
| `[start:end:step]` | Array slice where `start`, `end`, and `step` are indexes. |
@@ -135,25 +133,25 @@ JSON.GET obj2 $.b[0]
135133
JSON.GET obj2 $.*[0]
136134
```
137135

138-
Redis Stack also supports slice syntax for arrays: `[start:`end`:`step`]`, where `start`, ``end``, and ``step`` are indexes.
139-
The following rules apply:
140-
141-
- If the current node is an array, an array containing elements extracted from an array are returned, based on a start index, an `end` index, and a `step` index.
142-
Array indexes are 0-based. Start Index is inclusive; End index is not inclusive.
136+
Redis Stack also supports slice syntax for arrays: `[start:`end`:`step`]`, where `start`, `end`, and `step` are indexes.
137+
If the current node is an array, an array containing elements extracted from an array are returned, based on a `start` index, an `end` index, and a `step` index.
138+
Array indexes are zero-based; the first element is index 0. Start Index is inclusive; End index is not inclusive.
143139
The following rules apply:
144140

145-
- If `start` is specified, it must be an integer.
146-
- if `start` is omitted, it is replaced with 0.
147-
- if `start` < 0, it is replaced with min(0, `start` + array-length).
148-
- if `start` > array-length, an empty array is returned.
149-
- if `end` is specified, it must be an integer.
150-
- If `end` is omitted, it is replaced with array-length.
151-
- If `end` ≥ array-length, it is replaced with array-length.
152-
- if `end` < 0, it is replaced with min(0, `end` + array-length).
153-
- If `end``start` (after normalization), an empty array is returned.
154-
- if `step` is specified, it must be a positive integer.
155-
- if `step` is omitted, it is replaced with 1.
156-
- If the current node in not an array, an empty array is returned.
141+
| Predicate | Rule |
142+
| --------- | ---- |
143+
| If `start` is specified | it must be an integer |
144+
| if `start` is omitted | it is replaced with 0 |
145+
| if `start` < 0 | it is replaced with min(0, `start` + array-length) |
146+
| if `start` > array-length | an empty array is returned |
147+
| if `end` is specified | it must be an integer |
148+
| If `end` is omitted | it is replaced with array-length |
149+
| If `end` ≥ array-length | it is replaced with array-length |
150+
| if `end` < 0 | it is replaced with min(0, `end` + array-length) |
151+
| If `end``start` (after normalization) | an empty array is returned |
152+
| If `step` is specified | it must be a positive integer |
153+
| If `step` is omitted | it is replaced with 1 |
154+
| If the current node in not an array | an empty array is returned |
157155

158156
```redis Array slice examples
159157
JSON.GET arr1 $[:]

src/ds/json/create.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ JSON.SET bicycle:1 $ '{
1212
"material": "aluminium",
1313
"weight": "10"
1414
},
15-
"description": "Small and powerful, the Jigger is the best ride for the smallest of tikes! This is the tiniest kids\u2019 pedal bike on the market available without a coaster brake, the Jigger is the vehicle of choice for the rare tenacious little rider raring to go. We say rare because this smokin\u2019 little bike is not ideal for a nervous first-time rider, but it\u2019s a true giddy up for a true speedster. The Jigger is a 12 inch lightweight kids bicycle and it will meet your little one\u2019s need for speed. It\u2019s a single speed bike that makes learning to pump pedals simple and intuitive. It even has a handle in the bottom of the saddle so you can easily help your child during training! The Jigger is among the most lightweight children\u2019s bikes on the planet. It is designed so that 2-3 year-olds fit comfortably in a molded ride position that allows for efficient riding, balanced handling and agility. The Jigger\u2019s frame design and gears work together so your buddingbiker can stand up out of the seat, stop rapidly, rip over trails and pump tracks. The Jigger\u2019s is amazing on dirt or pavement. Your tike will speed down the bike path in no time. The Jigger will ship with a coaster brake. A freewheel kit is provided at no cost.",
15+
"description": "The Jigger is the best ride for the smallest of tikes!",
1616
"addons": [
1717
"reflectors",
1818
"grip tassles"
@@ -50,7 +50,7 @@ JSON.GET bicycle:1 $.addons[0]
5050
You can create multiple documents in a single command using `JSON.MSET`:
5151

5252
```redis Add two more documents using JSON.MGET
53-
JSON.MSET "bicycle:2" $ "{\"model\": \"Hillcraft\", \"brand\": \"Bicyk\", \"price\": 1200, \"type\": \"Kids Mountain Bikes\", \"specs\": {\"material\": \"carbon\", \"weight\": \"11\"}, \"description\": \"Kids want to ride with as little weight as possible. Especially on an incline! They may be at the age when a 27.5\\\" wheel bike is just too clumsy coming off a 24\\\" bike. The Hillcraft 26 is just the solution they need! Imagine 120mm travel. Boost front/rear. You have NOTHING to tweak because it is easy to assemble right out of the box. The Hillcraft 26 is an efficient trail trekking machine. Up or down does not matter - dominate the trails going both down and up with this amazing bike. The name Monarch comes from Monarch trail in Colorado where we love to ride. It\u2019s a highly technical, steep and rocky trail but the rip on the waydown is so fulfilling. Don\u2019t ride the trail on a hardtail! It is so much more fun on the full suspension Hillcraft! Hit your local trail with the Hillcraft Monarch 26 to get to where you want to go.\", \"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\": \"The Chook Air 5 gives kids aged six years and older a durable and uberlight mountain bike for their first experience on tracks and easy cruising through forests and fields. The lower top tube makes it easy to mount and dismount in any situation, giving your kids greater safety on the trails. The Chook Air 5 is the perfect intro to mountain biking.\", \"addons\": [\"reflectors\", \"safety lights\"],\"helmet_included\": false}"
53+
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

5656
You can retrieve multiple documents or parts of documents in a single command using `JSON.MGET`:

src/ds/json/learn-more.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
### Blogs
1111

12-
* [RedisJSON: Public Preview & Performance Benchmarking](https://redis.com/blog/redisjson-public-preview-performance-benchmarking/)
12+
* [RedisJSON: Public Preview & Performance Benchmarking](https://redis.com/blog/redisjson-public-preview-performance-benchmarking/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials)
1313
* [Indexing, Querying, and Full-Text Search of JSON Documents with Redis](https://redis.com/blog/index-and-query-json-docs-with-redis/)
1414

src/ds/json/modify.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,33 @@ Here are some examples.
44

55
## Extend documents
66

7-
```redis Add a new key:value pair to an existing document
8-
JSON.SET bicycle:1 $.newkey '"value"'
7+
```redis Add a new name-value pair to an existing document
8+
JSON.SET bicycle:1 $.newmember '"value"'
99
```
1010

11-
You could also use `JSON.MSET` to create or update multiple documents at the same time. First, delete `$.newkey` from `bicycle:1` using `JSON.DEL`.
11+
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 $.newkey from bicycle:1
14-
JSON.DEL bicycle:1 $.newkey
13+
```redis Delete $.newmember from bicycle:1
14+
JSON.DEL bicycle:1 $.newmember
1515
```
1616

17-
Next, add `$.newkey` to all three bicycles:
17+
Next, add `$.newmember` to all three bicycles:
1818

19-
```redis Add $.newkey too all three bicycles using JSON.MSET
20-
JSON.MSET bicycle:1 $.newkey '"value1"' bicycle:2 $.newkey '"value2"' bicycle:3 $.newkey '"value3"'
21-
JSON.MGET bicycle:1 bicycle:2 bicycle:3 $.newkey
19+
```redis Add a member named newmember too all three bicycles using JSON.MSET
20+
JSON.MSET bicycle:1 $.newmember '"value1"' bicycle:2 $.newmember '"value2"' bicycle:3 $.newmember '"value3"'
21+
JSON.MGET bicycle:1 bicycle:2 bicycle:3 $.newmember
2222
```
2323

2424
## Manipulate numeric values
2525

26-
There are two commands that allow you to perform arithmetic operations on components of documents:
27-
28-
- `JSON.NUMINCRBY` - adds a value to a numeric field.
26+
The `JSON.NUMINCRBY` command allows you to perform arithmetic operations on numeric fields of documents.
27+
Use positive numbers to increment and negative numbers to decrement.
2928

3029
```redis Decrease the price of bicycle:1
3130
JSON.GET bicycle:1 $.price
3231
JSON.NUMINCRBY bicycle:1 $.price -10
3332
JSON.GET bicycle:1 $.price
3433
```
35-
36-
- `JSON.NUMMULTBY` - multiply a numeric field by a value.
37-
38-
```redis Discount bicycle:1 by 10%
39-
JSON.NUMMULTBY bicycle:1 $.price 0.9
40-
```
4134
## Manipulate string and boolean values
4235

4336
Appending information to JSON strings is straightforward.
@@ -61,8 +54,8 @@ As you saw earlier, the `JSON.MERGE` command can be used to create new documents
6154

6255
- Create a non-existant path-value:
6356

64-
```redis Add a new field-value pair to bicycle:1
65-
JSON.MERGE bicycle:1 $.newkey2 '"value 2 1"'
57+
```redis Add a new name-value pair to bicycle:1
58+
JSON.MERGE bicycle:1 $.newmember2 '"value 2 1"'
6659
JSON.GET bicycle:1
6760
```
6861

@@ -75,8 +68,8 @@ JSON.GET bicycle:1 $.model
7568

7669
- Delete an existing value:
7770

78-
```redis Delete newkey2 from bicycle:1
79-
JSON.MERGE bicycle:1 $ '{"newkey2": null}'
71+
```redis Delete newmember2 from bicycle:1
72+
JSON.MERGE bicycle:1 $ '{"newmember2": null}'
8073
JSON.GET bicycle:1
8174
```
8275

@@ -91,10 +84,10 @@ JSON.GET bicycle:1 $.addons
9184

9285
## Delete information
9386

94-
You can delete field-value pairs using the `JSON.DEL` or `JSON.FORGET` commands:
87+
You can delete name-value pairs using the `JSON.DEL` or `JSON.FORGET` commands:
9588

96-
```redis Delete newkey from bicycle:1
97-
JSON.DEL bicycle:1 $.newkey
89+
```redis Delete newmember from bicycle:1
90+
JSON.DEL bicycle:1 $.newmember
9891
JSON.GET bicycle:1
9992
```
10093

src/ds/json/objects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ JSON.OBJKEYS doc $.o
1616

1717
- `JSON.OBJLEN` - get the number of fields of a JSON object.
1818

19-
```redis Get the number of fields in the doc object
19+
```redis Get the number of members of the object at the root of document doc
2020
JSON.OBJLEN doc
2121
```
2222

23-
```redis Get the number of fields in the $.o object
23+
```redis Get the number of members of the $.o object of document doc
2424
JSON.OBJLEN doc $.o
2525
```

src/ds/lists.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You interact with lists using commands such as:
1313
- LPOP - removes and returns an item from the beginning of a list.
1414
- RPOP - removes and returns an item from the end of a list.
1515

16-
You can begin working with a list without first creating its key, simply by adding values to the key. This works as long as the key doesn't already exist as a different type.
16+
You can begin using with a list without first creating its key, simply by adding values to the key. This works as long as the key doesn't already exist as a different type.
1717

1818
**Note**:
1919
> This is generally true for every Redis data structure, though there are a few exceptions.
@@ -55,7 +55,7 @@ LRANGE bike:colors 1 2
5555
LRANGE bike:colors 1 -2
5656
```
5757

58-
To find out how many elements are in a list, use the `LLEN` command.
58+
To retrieve the number of elements in a list, use the `LLEN` command.
5959

6060
```redis LLEN usage
6161
LLEN bike:colors

src/ds/prob/bloom-cuckoo.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,25 @@ You can read more about Bloom filters and their use cases [here](https://redis.i
5454

5555
## Cuckoo Filters
5656

57-
[Cuckoo filters](https://en.wikipedia.org/wiki/Cuckoo_filter), which are similar to Bloom filters, are used to determine, with a high degree of certainty, whether or not an element is a member of a set. Unlike Bloom filters, you can delete items from a cuckoo filter.
57+
[Cuckoo filters](https://en.wikipedia.org/wiki/Cuckoo_filter), which are similar to Bloom filters, are used to determine, with a high degree of certainty, whether or not an element is a member of a filter. Unlike Bloom filters, you can delete items from a cuckoo filter. Unlike Bloom filters, you can add the same element multiple times to a Cuckoo filter (see the `CF.COUNT` example below).
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

6161
```redis 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

65+
**Note:**
66+
> `BUCKETSIZE`, `MAXITERATIONS`, and `EXPANSION` are optional arguments and default to `2`, `20`, `1`, respectively.
67+
6568
Next, add items to the cuckoo filter.
6669
Note that `CF.ADD` creates a new filter if one doesn't already exist.
6770

6871
```redis Add Items
69-
CMS.ADD bikes:models "Smokey Mountain Striker"
70-
CMS.ADD bikes:models "Cloudy City Cruiser"
71-
CMS.ADD bikes:models "Rocky Mountain Racer"
72-
CMS.ADD bikes:models "Smokey Mountain Striker" // second addition of Smokey...
72+
CF.ADD bikes:models "Smokey Mountain Striker"
73+
CF.ADD bikes:models "Cloudy City Cruiser"
74+
CF.ADD bikes:models "Rocky Mountain Racer"
75+
CF.ADD bikes:models "Smokey Mountain Striker" // second addition of Smokey...
7376
```
7477

7578
Use the `CF.EXISTS` command to determine whether or not an item may exist in the cuckoo filter.

src/ds/prob/count-min-sketch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
In this tutorial you will learn how to use a count-min sketch to track profits in a bike shop use case.
22

3-
A count-min sketch is used to determine the frequency of events in a stream. You can query the count-min sketch to get an estimate of the frequency of any given event.
3+
A count-min sketch is used to determine the frequency of distinct values in a stream. You can query the count-min sketch to get an estimate of the frequency of any given value.
44

55
You can initialize the count-min sketch and specify a width (the number of counters in each array) and depth (the number of counter-arrays).
66

@@ -16,14 +16,14 @@ You can also initialize a count-min sketch by providing an acceptable error rate
1616
CMS.INITBYPROB bikes:profits 0.001 0.01 // initializes the count-min sketch with 0.1% estimation of error and 1% desired probability for inflated count
1717
```
1818

19-
You can increase the count associated with an item by a supplied increment:
19+
You can increase the frequency associated with an item by a supplied increment:
2020

2121
```redis Update
2222
CMS.INCRBY bikes:profit "Smokey Mountain Striker" 100
2323
CMS.INCRBY bikes:profit "Rocky Mountain Racer" 200 "Cloudy City Cruiser" 150
2424
```
2525

26-
Retrieve the counts for several items from the sketch:
26+
Retrieve the frequencies for several items from the sketch:
2727

2828
```redis Return query
2929
CMS.QUERY bikes:profit "Smokey Mountain Striker" "Rocky Mountain Racer" "Cloudy City Cruiser" "Terrible Bike Name"

src/ds/prob/hyperloglog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
In this tutorial you will learn how to use the HyperLogLog (HLL) probabilistic data structure in a bike shop use case.
22

3-
HyperLogLog is a probabilistic data structure that estimates the cardinality of a set. As a probabilistic data structure, HLL trades perfect accuracy for efficient space utilization.
3+
HyperLogLog is a probabilistic data structure that estimates the number of unique elements (cardinality) of a set. As a probabilistic data structure, HLL trades perfect accuracy for efficient space utilization.
44
The Redis HLL implementation uses at most 12 KB of memory and provides a standard error of 0.81%.
55

6-
A common use case for HLLs is to track the number anonymous unique visits to a web resource. HLLs help answer questions like:
6+
A common use case for HLLs is to track the number unique visits to a web resource. HLLs help answer questions like:
77

88
- How many unique visits has this page had on this day?
99
- How many unique users have played this song?

0 commit comments

Comments
 (0)