Skip to content

Commit 1afd5de

Browse files
Debrands RedisJSON
1 parent 5db0b1d commit 1afd5de

File tree

6 files changed

+85
-85
lines changed

6 files changed

+85
-85
lines changed

docs/docs/_index.md

+49-49
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: RedisJSON
2+
title: JSON
33
description: JSON support for Redis
44
linkTitle: JSON
55
type: docs
@@ -9,7 +9,7 @@ stack: true
99
[![Discord](https://img.shields.io/discord/697882427875393627?style=flat-square)](https://discord.gg/QUkjSsk)
1010
[![Github](https://img.shields.io/static/v1?label=&message=repository&color=5961FF&logo=github)](https://github.com/RedisJSON/RedisJSON/)
1111

12-
The RedisJSON module provides JSON support for Redis. RedisJSON lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. RedisJSON also works seamlessly with [RediSearch](https://redis.io/docs/stack/search/) to let you [index and query JSON documents](https://redis.io/docs/stack/search/indexing_json).
12+
Redis JSON provides JavaScript Object Notation (JSON) support for Redis. It lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. Redis JSON also works seamlessly with [Search and Query](https://redis.io/docs/stack/search/) to let you [index and query JSON documents](https://redis.io/docs/stack/search/indexing_json).
1313

1414
## Primary features
1515

@@ -18,22 +18,22 @@ The RedisJSON module provides JSON support for Redis. RedisJSON lets you store,
1818
* Documents stored as binary data in a tree structure, allowing fast access to sub-elements
1919
* Typed atomic operations for all JSON value types
2020

21-
## Use RedisJSON
21+
## Use Redis JSON
2222

23-
To learn how to use RedisJSON, it's best to start with the Redis CLI. The following examples assume that you're connected to a Redis server with RedisJSON enabled.
23+
To learn how to use JSON, it's best to start with the Redis CLI. The following examples assume that you're connected to a Redis server with JSON enabled.
2424

2525
### `redis-cli` examples
2626

2727
First, start [`redis-cli`](http://redis.io/topics/rediscli) in interactive mode.
2828

29-
The first RedisJSON command to try is `JSON.SET`, which sets a Redis key with a JSON value. `JSON.SET` accepts all JSON value types. This example creates a JSON string:
29+
The first JSON command to try is `JSON.SET`, which sets a Redis key with a JSON value. `JSON.SET` accepts all JSON value types. This example creates a JSON string:
3030

3131
```sh
32-
127.0.0.1:6379> JSON.SET animal $ '"dog"'
32+
> JSON.SET animal $ '"dog"'
3333
"OK"
34-
127.0.0.1:6379> JSON.GET animal $
34+
> JSON.GET animal $
3535
"[\"dog\"]"
36-
127.0.0.1:6379> JSON.TYPE animal $
36+
> JSON.TYPE animal $
3737
1) "string"
3838
```
3939

@@ -42,77 +42,77 @@ Note how the commands include the dollar sign character `$`. This is the [path](
4242
Here are a few more string operations. `JSON.STRLEN` tells you the length of the string, and you can append another string to it with `JSON.STRAPPEND`.
4343

4444
```sh
45-
127.0.0.1:6379> JSON.STRLEN animal $
45+
> JSON.STRLEN animal $
4646
1) "3"
47-
127.0.0.1:6379> JSON.STRAPPEND animal $ '" (Canis familiaris)"'
47+
> JSON.STRAPPEND animal $ '" (Canis familiaris)"'
4848
1) "22"
49-
127.0.0.1:6379> JSON.GET animal $
49+
> JSON.GET animal $
5050
"[\"dog (Canis familiaris)\"]"
5151
```
5252

5353
Numbers can be [incremented](/commands/json.numincrby) and [multiplied](/commands/json.nummultby):
5454

5555
```
56-
127.0.0.1:6379> JSON.SET num $ 0
56+
> JSON.SET num $ 0
5757
OK
58-
127.0.0.1:6379> JSON.NUMINCRBY num $ 1
58+
> JSON.NUMINCRBY num $ 1
5959
"[1]"
60-
127.0.0.1:6379> JSON.NUMINCRBY num $ 1.5
60+
> JSON.NUMINCRBY num $ 1.5
6161
"[2.5]"
62-
127.0.0.1:6379> JSON.NUMINCRBY num $ -0.75
62+
> JSON.NUMINCRBY num $ -0.75
6363
"[1.75]"
64-
127.0.0.1:6379> JSON.NUMMULTBY num $ 24
64+
> JSON.NUMMULTBY num $ 24
6565
"[42]"
6666
```
6767

6868
Here's a more interesting example that includes JSON arrays and objects:
6969

7070
```
71-
127.0.0.1:6379> JSON.SET example $ '[ true, { "answer": 42 }, null ]'
71+
> JSON.SET example $ '[ true, { "answer": 42 }, null ]'
7272
OK
73-
127.0.0.1:6379> JSON.GET example $
73+
> JSON.GET example $
7474
"[[true,{\"answer\":42},null]]"
75-
127.0.0.1:6379> JSON.GET example $[1].answer
75+
> JSON.GET example $[1].answer
7676
"[42]"
77-
127.0.0.1:6379> JSON.DEL example $[-1]
77+
> JSON.DEL example $[-1]
7878
(integer) 1
79-
127.0.0.1:6379> JSON.GET example $
79+
> JSON.GET example $
8080
"[[true,{\"answer\":42}]]"
8181
```
8282

8383
The `JSON.DEL` command deletes any JSON value you specify with the `path` parameter.
8484

85-
You can manipulate arrays with a dedicated subset of RedisJSON commands:
85+
You can manipulate arrays with a dedicated subset of JSON commands:
8686

8787
```
88-
127.0.0.1:6379> JSON.SET arr $ []
88+
> JSON.SET arr $ []
8989
OK
90-
127.0.0.1:6379> JSON.ARRAPPEND arr $ 0
90+
> JSON.ARRAPPEND arr $ 0
9191
1) (integer) 1
92-
127.0.0.1:6379> JSON.GET arr $
92+
> JSON.GET arr $
9393
"[[0]]"
94-
127.0.0.1:6379> JSON.ARRINSERT arr $ 0 -2 -1
94+
> JSON.ARRINSERT arr $ 0 -2 -1
9595
1) (integer) 3
96-
127.0.0.1:6379> JSON.GET arr $
96+
> JSON.GET arr $
9797
"[[-2,-1,0]]"
98-
127.0.0.1:6379> JSON.ARRTRIM arr $ 1 1
98+
> JSON.ARRTRIM arr $ 1 1
9999
1) (integer) 1
100-
127.0.0.1:6379> JSON.GET arr $
100+
> JSON.GET arr $
101101
"[[-1]]"
102-
127.0.0.1:6379> JSON.ARRPOP arr $
102+
> JSON.ARRPOP arr $
103103
1) "-1"
104-
127.0.0.1:6379> JSON.ARRPOP arr $
104+
> JSON.ARRPOP arr $
105105
1) (nil)
106106
```
107107

108108
JSON objects also have their own commands:
109109

110110
```
111-
127.0.0.1:6379> JSON.SET obj $ '{"name":"Leonard Cohen","lastSeen":1478476800,"loggedOut": true}'
111+
> JSON.SET obj $ '{"name":"Leonard Cohen","lastSeen":1478476800,"loggedOut": true}'
112112
OK
113-
127.0.0.1:6379> JSON.OBJLEN obj $
113+
> JSON.OBJLEN obj $
114114
1) (integer) 3
115-
127.0.0.1:6379> JSON.OBJKEYS obj $
115+
> JSON.OBJKEYS obj $
116116
1) 1) "name"
117117
2) "lastSeen"
118118
3) "loggedOut"
@@ -122,7 +122,7 @@ To return a JSON response in a more human-readable format, run `redis-cli` in ra
122122

123123
```sh
124124
$ redis-cli --raw
125-
127.0.0.1:6379> JSON.GET obj INDENT "\t" NEWLINE "\n" SPACE " " $
125+
> JSON.GET obj INDENT "\t" NEWLINE "\n" SPACE " " $
126126
[
127127
{
128128
"name": "Leonard Cohen",
@@ -134,7 +134,7 @@ $ redis-cli --raw
134134

135135
### Python example
136136

137-
This code snippet shows how to use RedisJSON with raw Redis commands from Python with [redis-py](https://github.com/redis/redis-py):
137+
This code snippet shows how to use JSON with raw Redis commands from Python with [redis-py](https://github.com/redis/redis-py):
138138

139139
```Python
140140
import redis
@@ -154,7 +154,7 @@ scientific_name = r.json().get('doc', '$..scientific-name')
154154

155155
### Run with Docker
156156

157-
To run RedisJSON with Docker, use the `redis-stack-server` Docker image:
157+
To run JSON with Docker, use the `redis-stack-server` Docker image:
158158

159159
```sh
160160
$ docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
@@ -164,34 +164,34 @@ For more information about running Redis Stack in a Docker container, see [Run R
164164

165165
### Download binaries
166166

167-
To download and run RedisJSON from a precompiled binary:
167+
To download and run JSON from a precompiled binary:
168168

169-
1. Download a precompiled version of RediSearch from the [Redis download center](https://redis.com/download-center/modules/).
169+
1. Download a precompiled version of Search and Query from the [Redis download center](https://redis.com/download-center/modules/).
170170

171-
1. Run Redis with RedisJSON:
171+
1. Run Redis with JSON:
172172

173173
```sh
174174
$ redis-server --loadmodule /path/to/module/src/rejson.so
175175
```
176176

177177
### Build from source
178178

179-
To build RedisJSON from the source code:
179+
To build JSON from the source code:
180180

181-
1. Clone the [RedisJSON repository](https://github.com/RedisJSON/RedisJSON) (make sure you include the `--recursive` option to properly clone submodules):
181+
1. Clone the [repository](https://github.com/RedisJSON/RedisJSON) (make sure you include the `--recursive` option to properly clone submodules):
182182

183183
```sh
184184
$ git clone --recursive https://github.com/RedisJSON/RedisJSON.git
185185
$ cd RedisJSON
186186
```
187187

188-
1. Install dependencies:
188+
2. Install dependencies:
189189

190190
```sh
191191
$ ./sbin/setup
192192
```
193193

194-
1. Build:
194+
3. Build:
195195
```sh
196196
$ make build
197197
```
@@ -210,7 +210,7 @@ Otherwise, you can invoke
210210
$ ./deps/readies/bin/getredis
211211
```
212212

213-
To load the RedisJSON module, use one of the following methods:
213+
To load the JSON module, use one of the following methods:
214214

215215
* [Makefile recipe](#makefile-recipe)
216216
* [Configuration file](#configuration-file)
@@ -219,7 +219,7 @@ To load the RedisJSON module, use one of the following methods:
219219

220220
#### Makefile recipe
221221

222-
Run Redis with RedisJSON:
222+
Run Redis with JSON:
223223

224224
```sh
225225
$ make run
@@ -241,9 +241,9 @@ loadmodule /path/to/module/target/release/librejson.dylib
241241

242242
In the above lines replace `/path/to/module/` with the actual path to the module.
243243

244-
Alternatively, you can download and run RedisJSON from a precompiled binary:
244+
Alternatively, you can download and run JSON from a precompiled binary:
245245

246-
1. Download a precompiled version of RedisJSON from the [Redis download center](https://redis.com/download-center/modules/).
246+
1. Download a precompiled version of JSON from the [Redis download center](https://redis.com/download-center/modules/).
247247

248248
#### Command-line option
249249

@@ -257,7 +257,7 @@ In the above lines replace `/path/to/module/` with the actual path to the module
257257
258258
#### `MODULE LOAD` command
259259
260-
You can also use the `MODULE LOAD` command to load RedisJSON. Note that `MODULE LOAD` is a **dangerous command** and may be blocked/deprecated in the future due to security considerations.
260+
You can also use the `MODULE LOAD` command to load JSON. Note that `MODULE LOAD` is a **dangerous command** and may be blocked/deprecated in the future due to security considerations.
261261
262262
After the module has been loaded successfully, the Redis log should have lines similar to:
263263

docs/docs/developer.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ description: >
66
Notes on debugging, testing and documentation
77
---
88

9-
# Developing RedisJSON
9+
# Developing Redis JSON
1010

11-
Developing RedisJSON involves setting up the development environment (which can be either Linux-based or macOS-based), building RedisJSON, running tests and benchmarks, and debugging both the RedisJSON module and its tests.
11+
Developing Redis JSON involves setting up the development environment (which can be either Linux-based or macOS-based), building JSON, running tests and benchmarks, and debugging both the JSON module and its tests.
1212

1313
## Cloning the git repository
14-
To clone the RedisJSON module and its submodules, run:
14+
To clone the JSON module and its submodules, run:
1515
```sh
1616
git clone --recursive https://github.com/RedisJSON/RedisJSON.git
1717
```
@@ -38,11 +38,11 @@ rejson=$(docker run -d -it -v $PWD:/build redisjson1 bash)
3838
docker exec -it $rejson bash
3939
```
4040

41-
You can replace `debian:bullseye` with your OS of choice. If you use the same OS as your host machine, you can run the RedisJSON binary on your host after it is built.
41+
You can replace `debian:bullseye` with your OS of choice. If you use the same OS as your host machine, you can run the JSON binary on your host after it is built.
4242

4343
## Installing prerequisites
4444

45-
To build and test RedisJSON one needs to install several packages, depending on the underlying OS. Currently, we support the Ubuntu/Debian, CentOS, Fedora, and macOS.
45+
To build and test JSON one needs to install several packages, depending on the underlying OS. Currently, we support the Ubuntu/Debian, CentOS, Fedora, and macOS.
4646

4747
Enter `RedisJSON` directory and run:
4848

@@ -124,13 +124,13 @@ make sanbox # create container for CLang Sanitizer tests
124124
```
125125

126126
## Building from source
127-
Run ```make build``` to build RedisJSON.
127+
Run ```make build``` to build JSON.
128128

129129
Notes:
130130

131131
* Binary files are placed under `target/release/`, according to platform and build variant.
132132

133-
* RedisJSON uses [Cargo](https://github.com/rust-lang/cargo) as its build system. ```make build``` will invoke both Cargo and the subsequent `make` command that's required to complete the build.
133+
* JSON uses [Cargo](https://github.com/rust-lang/cargo) as its build system. ```make build``` will invoke both Cargo and the subsequent `make` command that's required to complete the build.
134134

135135
Use ```make clean``` to remove built artifacts. ```make clean ALL=1``` will remove the entire bin subdirectory.
136136

@@ -154,7 +154,7 @@ $ REDIS_PORT=6379 make test
154154
```
155155

156156
## Debugging
157-
To include debugging information, you need to set the `DEBUG` environment variable before you compile RedisJSON. For example, run `export DEBUG=1`.
157+
To include debugging information, you need to set the `DEBUG` environment variable before you compile JSON. For example, run `export DEBUG=1`.
158158

159159
You can add breakpoints to Python tests in single-test mode. To set a breakpoint, call the ```BB()``` function inside a test.
160160

docs/docs/indexing_JSON.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: Index/Search JSON documents
33
linkTitle: Index/Search
44
weight: 2
5-
description: Combine RedisJSON and RediSearch to index and search JSON documents
5+
description: Combine Redis JSON and Search and Query to index and search JSON documents
66
---
77

8-
In addition to storing JSON documents, you can also index them using the [RediSearch](/docs/stack/search) module. This enables full-text search capabilities and document retrieval based on their content.
8+
In addition to storing JSON documents, you can also index them using the [Search and Query](/docs/stack/search) feature. This enables full-text search capabilities and document retrieval based on their content.
99

10-
To use these features, you must install two modules: RedisJSON and RediSearch. [Redis Stack](/docs/stack) automatically includes both modules.
10+
To use these features, you must install two modules: JSON and Search and Query. [Redis Stack](/docs/stack) automatically includes both modules.
1111

12-
See the [tutorial](/docs/stack/search/indexing_json) to learn how to use RediSearch with RedisJSON.
12+
See the [tutorial](/docs/stack/search/indexing_json) to learn how to use Search and Query with JSON.

docs/docs/path.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ weight: 3
55
description: Access specific elements within a JSON document
66
---
77

8-
Paths help you access specific elements within a JSON document. Since no standard for JSON path syntax exists, RedisJSON implements its own. RedisJSON's syntax is based on common best practices and intentionally resembles [JSONPath](http://goessner.net/articles/JsonPath/).
8+
Paths help you access specific elements within a JSON document. Since no standard for JSON path syntax exists, Redis JSON implements its own. JSON's syntax is based on common best practices and intentionally resembles [JSONPath](http://goessner.net/articles/JsonPath/).
99

10-
RedisJSON supports two query syntaxes: [JSONPath syntax](#jsonpath-syntax) and the [legacy path syntax](#legacy-path-syntax) from the first version of RedisJSON.
10+
JSON supports two query syntaxes: [JSONPath syntax](#jsonpath-syntax) and the [legacy path syntax](#legacy-path-syntax) from the first version of JSON.
1111

12-
RedisJSON knows which syntax to use depending on the first character of the path query. If the query starts with the character `$`, it uses JSONPath syntax. Otherwise, it defaults to the legacy path syntax.
12+
JSON knows which syntax to use depending on the first character of the path query. If the query starts with the character `$`, it uses JSONPath syntax. Otherwise, it defaults to the legacy path syntax.
1313

1414
The returned value is a JSON string with a top-level array of JSON serialized strings.
1515
And if multi-paths are used, the return value is a JSON string with a top-level object with values that are arrays of serialized JSON values.
1616

1717
## JSONPath support
1818

19-
RedisJSON v2.0 introduced [JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
19+
JSON v2.0 introduced [JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
2020

2121
A JSONPath query can resolve to several locations in a JSON document. In this case, the JSON commands apply the operation to every possible location. This is a major improvement over [legacy path](#legacy-path-syntax) queries, which only operate on the first path.
2222

@@ -248,11 +248,11 @@ JSONPath queries also work with other JSON commands that accept a path as an arg
248248

249249
## Legacy path syntax
250250

251-
RedisJSON v1 had the following path implementation. RedisJSON v2 still supports this legacy path in addition to JSONPath.
251+
JSON v1 had the following path implementation. JSON v2 still supports this legacy path in addition to JSONPath.
252252

253-
Paths always begin at the root of a RedisJSON value. The root is denoted by a period character (`.`). For paths that reference the root's children, it is optional to prefix the path with the root.
253+
Paths always begin at the root of a Redis JSON value. The root is denoted by a period character (`.`). For paths that reference the root's children, it is optional to prefix the path with the root.
254254

255-
RedisJSON supports both dot notation and bracket notation for object key access. The following paths refer to _headphones_, which is a child of _inventory_ under the root:
255+
JSON supports both dot notation and bracket notation for object key access. The following paths refer to _headphones_, which is a child of _inventory_ under the root:
256256

257257
* `.inventory.headphones`
258258
* `inventory["headphones"]`
@@ -264,7 +264,7 @@ To access an array element, enclose its index within a pair of square brackets.
264264

265265
By definition, a JSON key can be any valid JSON string. Paths, on the other hand, are traditionally based on JavaScript's (and Java's) variable naming conventions.
266266

267-
Although RedisJSON can store objects that contain arbitrary key names, you can only use a legacy path to access these keys if they conform to these naming syntax rules:
267+
Although JSON can store objects that contain arbitrary key names, you can only use a legacy path to access these keys if they conform to these naming syntax rules:
268268

269269
1. Names must begin with a letter, a dollar sign (`$`), or an underscore (`_`) character
270270
2. Names can contain letters, digits, dollar signs, and underscores

0 commit comments

Comments
 (0)