dragonfly
dragonfly copied to clipboard
Arguments of XREVRANGE are flipped
Description
In XRANGE, the - and + tokens select the minimum and maximum IDs, respectively. So, the command
XRANGE stream - +
selects all items in the stream. In the context of XREVRANGE, the arguments to the command are flipped, i.e.,:
XREVRANGE stream end begin [COUNT count]
so, calling XREVRANGE stream - + should produce no meaningful output, however, it outputs the stream (in reverse):
127.0.0.1:6379> XRANGE stream - +
1) 1) "1676993775209-0"
2) 1) "f1"
2) "v1"
2) 1) "1676993779209-0"
2) 1) "f2"
2) "v2"
3) 1) "1676993781122-0"
2) 1) "f3"
2) "v3"
127.0.0.1:6379> XREVRANGE stream - +
1) 1) "1676993781122-0"
2) 1) "f3"
2) "v3"
2) 1) "1676993779209-0"
2) 1) "f2"
2) "v2"
3) 1) "1676993775209-0"
2) 1) "f1"
2) "v1"
whereas XREVRANGE + - produces an empty array.
Likewise for specific ranges.