I have upgraded the Redis version to the latest version`4.6.7` in node.js application and the Redis server version is 4.0.10
zrevrange is deprecated in the latest Node-Redis version. I used zRange with the REV flag. It is working fine in Redis 6.x server but not in the Redis 4.x server.
client.zRange( key , startIndex , stopIndex , {'REV': true} );
It throws the syntax error like this [ErrorReply: ERR syntax error]
Is there any way to resolve it?
Thanks in Advance!
Redis Server version 4 is very, very old and if possible you should upgrade to Redis 7 or 6.2 for a whole lot of good reasons - performance, security, features etc.
Node-Redis v4 allows you to run arbitrary commands with the
sendCommandfunction. You can use this to callZREVRANGEon your older Redis server like this by passing an array of strings tosendCommandrepresenting the command you want to run as you would run it inredis-cli:package.json:index.js:Results of running this code:
Note that the response you get doesn't get transformed by Node Redis, so you'll get an array like response which is what the underlying Redis protocol response for this command looks like.