HDEL
HDEL key field [field ...]
- Group
- Hash
- Complexity
- O(N) where N is the number of fields to remove
- Arity
- -3 (at least 3 words, counting the command name)
- Flags
- write, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
HDEL removes the given fields, and any time to live they had, from the hash
stored at key. Fields that do not exist are ignored. When the last field is
removed, the key itself is deleted.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Success | Integer: the number of fields that were removed | Same |
| Key does not exist | Integer 0 |
Same |
HDEL replies with a WRONGTYPE error if key holds a value that is not a
hash.
Examples
Section titled “Examples”127.0.0.1:6379> HSET user:1 name "Ada" lang "en"(integer) 2127.0.0.1:6379> HDEL user:1 lang missing(integer) 1127.0.0.1:6379> HDEL user:1 name(integer) 1127.0.0.1:6379> EXISTS user:1(integer) 0Compatibility
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.