• Steve Lorello's avatar
    changing min,max in ZRANGE -> start stop (#10097) · a64b2948
    Steve Lorello authored
    In 6.2.0 with the introduction of the REV subcommand in ZRANGE, there was a semantic shift in the arguments of ZRANGE when the REV sub-command is executed. Without the sub-command `min` and `max` (the old names of the arguments) are appropriate because if you put the min value and the max value in everything works fine.
    
    ```bash
    127.0.0.1:6379> ZADD myset 0 foo
    (integer) 1
    127.0.0.1:6379> ZADD myset 1 bar
    (integer) 1
    127.0.0.1:6379> ZRANGE myset 0 inf BYSCORE
    1) "foo"
    2) "bar"
    ``` 
    
    However - if you add the `REV` subcommand, ordering the arguments `min` `max` breaks the command:
    
    ```bash
    127.0.0.1:6379> ZRANGE myset 0 inf BYSCORE REV
    (empty array)
    ```
    
    why? because `ZRANGE` with the `REV` sub-command is expecting the `max` first and the `min` second (because it's a reverse range like `ZREVRANGEBYSCORE`):
    
    ```bash
    127.0.0.1:6379> ZRANGE myset 0 inf BYSCORE REV
    (empty array)
    ```
    a64b2948
zrange.json 2.86 KB