{"_id":"@redis/json@6.4.0-beta.0","bugs":{"url":"https://github.com/redis/node-redis/issues"},"dist":{"shasum":"c17f15b612cf0dd39c84dfd80c4bb76099786018","tarball":"http://registry-npm.ywwl.com/@redis/json/download/@redis/json-6.4.0-beta.0.tgz","fileCount":106,"integrity":"sha512-Rx5boFvgT1ICYIi24piZZD3CxSEFJ58KmfeZcznfYQXZpKgx1VDJ1ibT7R4+0GmtUakg+dZ3/rPHwTsa5thEDw==","signatures":[{"sig":"MEUCICG8sImdcwwM4AdJLK9fcuAdYCEFnnQ8FSHRxRkvBwcOAiEAgAXCnH3shbpE3kvZbsOX+pV8S1AZIuX22L4N1rkZg28=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCCy0tz+xrnN8RO0AE1yJSR61/5AYPAsOSq5hR3o5XVQAIgWhYbyCVoB2UsUhe8+X9TaWIVdfas0vsXvoWkptWrhM4="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@redis%2fjson@6.4.0-beta.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":161202,"size":19024,"noattachment":false,"key":"/@redis/json/-/@redis/json-6.4.0-beta.0.tgz"},"main":"./dist/lib/index.js","name":"@redis/json","types":"./dist/lib/index.d.ts","engines":{"node":">= 20.0.0"},"gitHead":"246d7886f030025ead17c24639ea0466ded194b9","license":"MIT","scripts":{"test":"nyc -r text-summary -r lcov mocha -r tsx --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporter-config.json --exit  './lib/**/*.spec.ts'","release":"release-it"},"version":"6.4.0-beta.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"a89fadfc-48a3-40df-96ba-d4dbf3798372"}},"homepage":"https://github.com/redis/node-redis/tree/master/packages/json","keywords":["redis","RedisJSON"],"repository":{"url":"git://github.com/redis/node-redis.git","type":"git"},"_npmVersion":"11.21.0","description":"This package provides support for the [RedisJSON](https://redis.io/docs/latest/develop/data-types/json/) module, which adds JSON as a native data type to Redis.","directories":{},"maintainers":[{"name":"dmaier-redislabs","email":"david.maier@redis.com"},{"name":"pavelpashov","email":"pavel.pashov@redis.com"},{"name":"nkaradzhov","email":"nkaradzhov89@gmail.com"}],"_nodeVersion":"22.23.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@redis/test-utils":"*"},"peerDependencies":{"@redis/client":"^6.4.0-beta.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/json_6.4.0-beta.0_1791806911828_0.2624189289898293"},"readme":"# @redis/json\n\nThis package provides support for the [RedisJSON](https://redis.io/docs/latest/develop/data-types/json/) module, which adds JSON as a native data type to Redis.\n\nShould be used with [`redis`/`@redis/client`](https://github.com/redis/node-redis).\n\n:warning: To 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 [examples folder](https://github.com/redis/node-redis/tree/master/examples).\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\nawait client.json.set('noderedis:jsondata', '$', {\n  name: 'Roberta McDonald',\n  pets: [{\n    name: 'Rex',\n    species: 'dog',\n    age: 3,\n    isMammal: true\n  }, {\n    name: 'Goldie',\n    species: 'fish',\n    age: 2,\n    isMammal: false\n  }]\n});\n```\n\nFor more information about RedisJSON's path syntax, [check out the documentation](https://redis.io/docs/latest/develop/data-types/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","publish_time":1791806911922,"_cnpm_publish_time":1791806911922,"dist-tags":{"beta":"6.4.0-beta.0","latest":"6.3.1","next":"5.0.0-next.7"}}