{"_id":"@node-redis/json","_rev":"2347565","name":"@node-redis/json","description":"This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis.  It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON command","dist-tags":{"latest":"1.0.2","next":"1.0.0-rc.0"},"maintainers":[{"name":"leibale","email":"leibale1998@gmail.com"}],"time":{"modified":"2022-01-13T12:31:19.000Z","created":"2021-11-16T07:37:52.276Z","1.0.2":"2022-01-13T12:26:03.990Z","1.0.1":"2021-12-13T20:39:33.925Z","1.0.0":"2021-11-25T02:51:24.999Z","1.0.0-rc.0":"2021-11-16T07:37:52.276Z"},"users":{},"versions":{"1.0.2":{"name":"@node-redis/json","version":"1.0.2","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'","build":"tsc","documentation":"typedoc"},"peerDependencies":{"@node-redis/client":"^1.0.0"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.2","@node-redis/test-utils":"*","@types/node":"^17.0.8","nyc":"^15.1.0","release-it":"^14.12.1","source-map-support":"^0.5.21","ts-node":"^10.4.0","typedoc":"^0.22.10","typescript":"^4.5.4"},"gitHead":"2c4565f56c71ab11ccff285e76480fe152c167b1","description":"This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis.  It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON command","_id":"@node-redis/json@1.0.2","_nodeVersion":"16.10.0","_npmVersion":"8.1.2","dist":{"shasum":"8ad2d0f026698dc1a4238cc3d1eb099a3bee5ab8","size":4912,"noattachment":false,"key":"/@node-redis/json/-/@node-redis/json-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@node-redis/json/download/@node-redis/json-1.0.2.tgz"},"_npmUser":{"name":"leibale","email":"leibale1998@gmail.com"},"directories":{},"maintainers":[{"name":"leibale","email":"leibale1998@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json_1.0.2_1642076763604_0.3192865639523699"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-13T12:26:16.802Z","publish_time":1642076763990,"_cnpm_publish_time":1642076763990},"1.0.1":{"name":"@node-redis/json","version":"1.0.1","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'","build":"tsc","documentation":"typedoc"},"peerDependencies":{"@node-redis/client":"^1.0.0"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.2","@node-redis/test-utils":"*","@types/node":"^16.11.12","nyc":"^15.1.0","release-it":"^14.11.8","source-map-support":"^0.5.21","ts-node":"^10.4.0","typedoc":"^0.22.10","typescript":"^4.5.3"},"gitHead":"2449ad419731e8f1f2f97effb6bf88ac3400c677","description":"This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis.  It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON command","_id":"@node-redis/json@1.0.1","_nodeVersion":"16.10.0","_npmVersion":"8.1.2","dist":{"shasum":"8cd987c1855392adf21bc4f06163a7eda97a40a3","size":4910,"noattachment":false,"key":"/@node-redis/json/-/@node-redis/json-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@node-redis/json/download/@node-redis/json-1.0.1.tgz"},"_npmUser":{"name":"leibale","email":"leibale1998@gmail.com"},"directories":{},"maintainers":[{"name":"leibale","email":"leibale1998@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json_1.0.1_1639427973759_0.7072099200475312"},"_hasShrinkwrap":false,"publish_time":1639427973925,"_cnpm_publish_time":1639427973925},"1.0.0":{"name":"@node-redis/json","version":"1.0.0","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'","build":"tsc"},"peerDependencies":{"@node-redis/client":"^1.0.0"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","@node-redis/test-utils":"*","@types/node":"^16.11.10","nyc":"^15.1.0","release-it":"^14.11.8","source-map-support":"^0.5.21","ts-node":"^10.4.0","typescript":"^4.5.2"},"gitHead":"ae06af64fa944948fbe76529a7eba31a0f419c57","description":"This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis.  It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON command","_id":"@node-redis/json@1.0.0","_nodeVersion":"16.10.0","_npmVersion":"8.1.2","dist":{"shasum":"11ba5882ac1f3226a8042f5de318c94bad520802","size":7934,"noattachment":false,"key":"/@node-redis/json/-/@node-redis/json-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@node-redis/json/download/@node-redis/json-1.0.0.tgz"},"_npmUser":{"name":"leibale","email":"leibale1998@gmail.com"},"directories":{},"maintainers":[{"name":"leibale","email":"leibale1998@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json_1.0.0_1637808684782_0.6206540934285112"},"_hasShrinkwrap":false,"publish_time":1637808684999,"_cnpm_publish_time":1637808684999},"1.0.0-rc.0":{"name":"@node-redis/json","version":"1.0.0-rc.0","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'","build":"tsc"},"peerDependencies":{"@node-redis/client":"^1.0.0-rc"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","@node-redis/test-utils":"*","@types/node":"^16.11.7","nyc":"^15.1.0","release-it":"^14.11.7","source-map-support":"^0.5.20","ts-node":"^10.4.0","typescript":"^4.4.4"},"gitHead":"4bca55afff38fe24bf513e58efa430a6c60833ce","description":"The sources and docs for this package are in the main [node-redis](https://github.com/redis/node-redis) repo.","_id":"@node-redis/json@1.0.0-rc.0","_nodeVersion":"16.10.0","_npmVersion":"8.1.2","dist":{"shasum":"6df8b01254bc4422cfc0efbed59754da2a217a2d","size":7019,"noattachment":false,"key":"/@node-redis/json/-/@node-redis/json-1.0.0-rc.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@node-redis/json/download/@node-redis/json-1.0.0-rc.0.tgz"},"_npmUser":{"name":"leibale","email":"leibale1998@gmail.com"},"directories":{},"maintainers":[{"name":"leibale","email":"leibale1998@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json_1.0.0-rc.0_1637048272119_0.8845988123998425"},"_hasShrinkwrap":false,"publish_time":1637048272276,"_cnpm_publish_time":1637048272276}},"readme":"# @node-redis/json\n\nThis package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis.  It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON commands.\n\nTo use these extra commands, your Redis server must have the RedisJSON module installed.\n\n## Usage\n\nFor a complete example, see [`managing-json.js`](https://github.com/redis/node-redis/blob/master/examples/managing-json.js) in the Node Redis examples folder.\n\n### Storing JSON Documents in Redis\n\nThe [`JSON.SET`](https://oss.redis.com/redisjson/commands/#jsonset) command stores a JSON value at a given JSON Path in a Redis key.\n\nHere, we'll store a JSON document in the root of the Redis key \"`mydoc`\":\n\n```javascript\nimport { createClient } from 'redis';\n\n...\nawait client.json.set('noderedis:jsondata', '$', {\n  name: 'Roberta McDonald',\n  pets: [\n    {\n    name: 'Rex',\n    species: 'dog',\n    age: 3,\n    isMammal: true\n    },\n    {\n    name: 'Goldie',\n    species: 'fish',\n    age: 2,\n    isMammal: false\n    }\n  ]\n});\n```\n\nFor more information about RedisJSON's path syntax, [check out the documentation](https://oss.redis.com/redisjson/path/).\n\n### Retrieving JSON Documents from Redis\n\nWith RedisJSON, we can retrieve all or part(s) of a JSON document using the [`JSON.GET`]() command and one or more JSON Paths.  Let's get the name and age of one of the pets:\n\n```javascript\nconst results = await client.json.get('noderedis:jsondata', {\n  path: [\n    '.pets[1].name',\n    '.pets[1].age'\n  ]\n});\n```\n\n`results` will contain the following:\n\n```javascript\n { '.pets[1].name': 'Goldie', '.pets[1].age': 2 }\n```\n\n### Performing Atomic Updates on JSON Documents Stored in Redis\n\nRedisJSON includes commands that can atomically update values in a JSON document, in place in Redis without having to first retrieve the entire document.\n\nUsing the [`JSON.NUMINCRBY`](https://oss.redis.com/redisjson/commands/#jsonnumincrby) command, we can update the age of one of the pets like this:\n\n```javascript\nawait client.json.numIncrBy('noderedis:jsondata', '.pets[1].age', 1);\n```\n\nAnd we can add a new object to the pets array with the [`JSON.ARRAPPEND`](https://oss.redis.com/redisjson/commands/#jsonarrappend) command:\n\n```javascript\n await client.json.arrAppend('noderedis:jsondata', '.pets', {\n    name: 'Robin',\n    species: 'bird',\n    age: 1,\n    isMammal: false\n  });\n```\n","_attachments":{},"license":"MIT"}