Back to Redis

ZREVRANGEBYLEX

content/commands/zrevrangebylex.md

latest1.3 KB
Original Source

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.

Apart from the reversed ordering, ZREVRANGEBYLEX is similar to [ZRANGEBYLEX]({{< relref "/commands/zrangebylex" >}}).

Examples

{{% redis-cli %}} ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g ZREVRANGEBYLEX myzset [c - ZREVRANGEBYLEX myzset (c - ZREVRANGEBYLEX myzset (g [aaa {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | Deprecated as of Redis v6.2.0. |

Return information

{{< multitabs id="zrevrangebylex-return-info" tab1="RESP2" tab2="RESP3" >}}

Array reply: a list of members in the specified score range.

-tab-sep-

Array reply: List of the elements in the specified score range.

{{< /multitabs >}}