RedisJson Rename a Node in the JsonPath
Hello,
What's the best practice to modify a node name in the path.
E.g: We have a path: $.animals.your.dogs.kuku I would like to rename dogs to cats so the final path would be: $.animals.your.cats.kuku
The problem is we need transaction (for the simplest way), to read the current "tree" under dogs, save it somewhere, SET a copy of that value to "cats" and then delete the dogs node.
The only option I found is using a Lua script in order to have the opration atomic.
I suppose if that would be supported by Redis/RedisJson, it probably would be a single RENAME operation.
Thanks for any guidance on this. Moshe.
ref https://github.com/RedisJSON/RedisJSON/issues/150
@Avdiel you can also use Redis Transactions see: https://redis.io/docs/manual/transactions/