Skip to content

Documentation does not mention ZRANGE WITHSCORES response difference between RESP2 and RESP3 #431

@anatawa12

Description

@anatawa12

The documentation for ZRANGE says ZRANGE WITHSCORES returns array interleaves element and score in examples section

The following example using `WITHSCORES` shows how the command returns always an array, but this time, populated with *element_1*, *score_1*, *element_2*, *score_2*, ..., *element_N*, *score_N*.

However, ZRANGE WITHSCORES on RESP3 returns array consists of array with 2 element instead of interleaved array.
This is undocunented differecne between RESP2 and RESP3.

$ redis-cli -3
127.0.0.1:6379> ZADD myzset 1 "one" 2 "two" 3 "three"
(integer) 3
127.0.0.1:6379> ZRANGE myzset 0 1 WITHSCORES
1) 1) "one"
   2) (double) 1
2) 1) "two"
   2) (double) 2
127.0.0.1:6379>

The "RESP2/RESP3 Reply" section at the bottom of documentation suggests both protocol returns same result so this section should also be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions