node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

ZREVRANGEBYSCORE

Open caikobe opened this issue 2 years ago • 1 comments

Hello, I can't find this method, how can I change the function? Zrevrangebyscore--Zrevrangebyscore--Zrevrangebyscore--Zrevrangebyscore

caikobe avatar Jun 30 '22 10:06 caikobe

https://redis.io/commands/zrevrangebyscore/ "As of Redis version 6.2.0, this command is regarded as deprecated.

It can be replaced by ZRANGE with the REV and BYSCORE arguments when migrating or writing new code."

leibale avatar Jun 30 '22 16:06 leibale

While it is true that ZREVRANGEBYSCORE has been deprecated, when using this library to connect to and older Redis 5 node, using

const items = await client.zRange(myKey, '+inf', 0, { BY: 'SCORE', REV: true })

will error with

[ErrorReply: ERR value is not an integer or out of range]

I can see two approaches:

  1. Modify the implementation of ZRANGE in this library to automatically send a ZREVRANGEBYSCORE command when connecting to older servers
  2. Implement the deprecated ZREVRANGEBYSCORE command in this library.

I am happy to do either, which would you recommend?

pas256 avatar Oct 14 '22 04:10 pas256