Skip to content

stockholmux/node_redis-rejson

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Actions Status npm version

RedisJSON Module plugin for node_redis

This package allows node_redis (2.8+) to interface with the Redis module RedisJSON.

To use this module, you will need Redis 4.0 or higher and the rejson module installed.

Usage

const
  redis = require('redis'),
  rejson = require('redis-rejson');

rejson(redis); /* important - this must come BEFORE creating the client */

let client = redis.createClient();
let my_json_key = 'my_json';
client.json_set(my_json_key, '.', '{"test":1234}', function (err) {
  if (err) { throw err; }
  console.log('Set JSON at key ' + my_json_key + '.');
  client.json_get(my_json_key, '.test', function (err, value) {
    if (err) { throw err; }
    console.log('value of test:', value); //outputs 1234
    client.quit();
  });
});

The RedisJSON commands will be mapped to javascript-friendly names (JSON.GET becomes client.json_get).

About

Node.js bindings for the ReJSON Redis module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •