Hands-on task
A JSON document in Redis
A user profile is in the file /root/user.json. Store it in Redis as a JSON document (the JSON module, not a string) under the key user:1, and then, without overwriting the whole document, modify it by JSON paths:
- increase
stats.loginsby 1 withJSON.NUMINCRBY; - append the string
"admin"to the end of therolesarray withJSON.ARRAPPEND.
The other fields (name, email, stats.last_ip) must stay as in the file.
- redis
- RedisJSON
- JSON.SET
- JSON.GET
- JSON.NUMINCRBY
- JSON.ARRAPPEND
- JSONPath