Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
Rust based RedisJSON implementation
Rust Python Other
Branch: master
Clone or download
VadimKulagin and gkorland Small fixes in the README.md (#77)
* Fix a typo in the README.md
* Use https instead of http in the README.md
Latest commit de4590d Dec 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci comment out the s3 deploy for now Sep 15, 2019
src backward for json.get multi path (#68) Oct 30, 2019
test ref #74 add test for usecase Dec 17, 2019
.gitignore add Cargo.lock Oct 28, 2019
Cargo.lock fix #74 use branch overflow bug fix Dec 17, 2019
Cargo.toml fix #74 use branch overflow bug fix Dec 17, 2019
Dockerfile Update Dockerfile Oct 28, 2019
LICENSE Update LICENSE Feb 28, 2019
README.md Small fixes in the README.md (#77) Dec 24, 2019
ramp.yml copy ramp.yml from RedisJSON Sep 15, 2019

README.md

GitHub issues CircleCI Docker Cloud Build Status Mailing List Gitter

RedisJSON2

RedisJSON2 (RedisJSON nextgen) is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating and fetching JSON values from Redis keys (documents).

Primary features:

  • Full support of the JSON standard
  • JSONPath syntax for selecting elements inside documents
  • Documents are stored as binary data in a tree structure, allowing fast access to sub-elements
  • Typed atomic operations for all JSON values types
  • Secondary index support based on RediSearch

Quick start

docker run -p 6379:6379 --name redis-redisjson redislabs/redisjson2:latest

New Commands in RedisJSON2

JSON.INDEX ADD <index> <field> <path>
JSON.QGET <index> <query> <path>

Next Milestone

JSON.QSET <index> <query> <path> <json> [NX | XX]
JSON.QDEL <index> <query> <path>

JSON.INDEX DEL <index> <field>
JSON.INDEX INFO <index> <field>

Return value from JSON.QGET is an array of keys and values:

key
json
key
json

In a language such as Java this could be represented as a Map<String, Document>.

Examples

A query combining multiple paths:

JSON.QGET mytype "@path1:hello @path2:world" d.name
127.0.0.1:6379> json.set user1 $ '{"last":"Joe", "first":"Mc"}' INDEX person
OK
127.0.0.1:6379> json.set user2 $ '{"last":"Joan", "first":"Mc"}' INDEX person
OK
127.0.0.1:6379> json.index add person last $.last
OK
127.0.0.1:6379> JSON.QGET person Jo*
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}]}"
127.0.0.1:6379> json.set user3 $ '{"last":"Joel", "first":"Dan"}' INDEX person
OK
127.0.0.1:6379> JSON.QGET person Jo*
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}],\"user3\":[{\"last\":\"Joel\",\"first\":\"Dan\"}]}"
127.0.0.1:6379> json.index add person first $.first
OK
127.0.0.1:6379> JSON.QGET person Mc
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}]}"
127.0.0.1:6379> JSON.QGET person Mc $.last
"{\"user2\":[\"Joan\"],\"user1\":[\"Joe\"]}"

Build

cargo build --release

Run

redis-server --loadmodule ./target/release/libredisjson.so
You can’t perform that action at this time.