I am trying to get a list in reverse score order.
I am using node redis v4.0.1 which no longer supports client.ZREVRANGEBYSCORE
If I try await client.zRangeByScoreWithScores(‘rankings’, ‘-inf’, ‘+inf’);
This produces a list in ascending order.
If I try await client.zRange(‘rankings’, ‘-inf’, ‘+inf’, {
BY: ‘SCORE’,
REV: true,
});
There is an empty list produced.
How do I get a list in reverse score order?
3
Answers
I guess you’re looking for
ZRANGEBYSCORE
, not the ‘rev’ one.So
ZRANGEBYSCORE -inf +inf
Try doing the following:
When I checked out the documentation, you should switch min and max if you set REV to true.
node redis v4.0 and the above version we use as below.