ZSCORE
ZSCORE key member
- Group
- Sorted set
- Complexity
- O(1)
- Arity
- 3 (exactly, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
ZSCORE returns the score of member in the sorted set stored at key. For
several members at once, use ZMSCORE.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Member exists | Bulk string: the score | Double: the score |
| Member or key does not exist | Nil bulk string | Null |
ZSCORE replies with a WRONGTYPE error if key holds a value that is not a
sorted set.
Examples
Section titled “Examples”127.0.0.1:6379> ZADD board 100 "alice" 92.5 "bob"(integer) 2127.0.0.1:6379> ZSCORE board "bob""92.5"127.0.0.1:6379> ZSCORE board "nobody"(nil)Compatibility
Section titled “Compatibility”Same as Redis 7.4 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.