I want to update multiple fields on redis with RedisJSON feature, by using Jedis java client;
Suppose we have a key:value like below in redis:
PERSON_1:{name=ali2, phone=1234, address=Tehran, education={uniName=Amirkabir}}
then we want to update phone
and address
fields.
But it seems we can just update only one path or multiple paths with the same field name at a time.
Like:JSON.GET PERSON_1 $phone 9876
If we accept that we can only update one field at a time, than we have to hit the redis twice for two fields.
Is there any way to update multiple fields at a time to keep atomicity and have better performance?
I tried to use Jedis like:
client.jsonSet("PERSIN_1", Path.of("phone"), "9876");
and
client.jsonSet("PERSIN_1", Path.of("address"), "Shiraz");
In this way, we hit the Redis sever twice.