Skip to content

stockholmux/node_redis-rejson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  •  
  •  
  •  
  •