{"name":"@redis/json","version":"2.0.0-next.1","license":"MIT","main":"./dist/lib/index.js","types":"./dist/lib/index.d.ts","scripts":{"test":"nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'"},"peerDependencies":{"@redis/client":"^2.0.0-next.3"},"devDependencies":{"@redis/test-utils":"*"},"repository":{"type":"git","url":"git://github.com/redis/node-redis.git"},"bugs":{"url":"https://github.com/redis/node-redis/issues"},"homepage":"https://github.com/redis/node-redis/tree/master/packages/json","keywords":["redis","RedisJSON"],"_id":"@redis/json@2.0.0-next.1","readme":"# @redis/json\n\nThis package provides support for the [RedisJSON](https://redis.io/docs/stack/json/) 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://redis.io/commands/json.set/) 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://redis.io/docs/stack/json/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`](https://redis.io/commands/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://redis.io/commands/json.numincrby/) 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://redis.io/commands/json.arrappend/) command:\n\n```javascript\nawait client.json.arrAppend('noderedis:jsondata', '.pets', {\n  name: 'Robin',\n  species: 'bird',\n  age: 1,\n  isMammal: false\n});\n```\n","readmeFilename":"README.md","gitHead":"8fb4a7ad61999ed77fd4456704cb2da9ac5de2f2","description":"This package provides support for the [RedisJSON](https://redis.io/docs/stack/json/) 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 Redi","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-//F6pdivjxl9rSlu+fgT5JZvRJrISKEAD5hA7/SZVNU7oHSjtXzGmAccAX+XOeCYhI93CGXODNq/gqhNaUZyrg==","shasum":"c869e19c33fd082db17014e3102e3f5437bb9450","tarball":"http://registry-npm.ywwl.com/@redis/json/download/@redis/json-2.0.0-next.1.tgz","fileCount":55,"unpackedSize":91177,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBKwuYtUQ1pjLv1uihcOkAoBc/iHLqxtazM+ctQcDJu8AiAs9AXZDM7QWEV0ZbudwOJC50ENq59Or1Q15ReJmEIoJQ=="}],"size":20486,"noattachment":false,"key":"/@redis/json/-/@redis/json-2.0.0-next.1.tgz"},"_npmUser":{"name":"leibale","email":"me@leibale.com"},"directories":{},"maintainers":[{"name":"leibale","email":"me@leibale.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json_2.0.0-next.1_1699583511919_0.09489751433591476"},"_hasShrinkwrap":false,"publish_time":1699583512089,"_cnpm_publish_time":1699583512089,"dist-tags":{"beta":"6.4.0-beta.0","latest":"6.3.1","next":"5.0.0-next.7"}}