Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

zset sort #1481

Closed
asdf20122012 opened this Issue Dec 25, 2013 · 3 comments

Comments

Projects
None yet
3 participants

I insert some data like :
zadd 'KPI' 200 '10000000007'
zadd 'KPI' 200 '10000000003'
zadd 'KPI' 200 '10000000002'
zadd 'KPI' 200 '10000000004'
zadd 'KPI' 200 '10000000001'

and then
zrevrange 'KPI' 0 -1
result:

  1. "10000000007"
  2. "10000000004"
  3. "10000000003"
  4. "10000000002"
  5. "10000000001"

I mean the right result:

  1. "10000000007"
  2. "10000000003"
  3. "10000000002"
  4. "10000000004"
  5. "10000000001"
Collaborator

badboy commented Dec 25, 2013

Sorted sets are ordered by their score. The order is not dependent on the insertion order. For the same score the order is undefined, therefor the current result is as correct as your proposed one.

ok thanks

Owner

antirez commented Feb 27, 2014

For the same score the order is defined, and is lexicographical.

@antirez antirez closed this Feb 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment