HDEL
Synopsis
HDEL key field [field ...]
This command removes the given fields from the hash that is associated with the given key.
- If the given
keydoes not exist, it is characterized as an empty hash, and 0 is returned for no elements are removed. - If the given
keyis associated with non-hash data, an error is raised.
Return value
Depends on the configuration parameter emulate_redis_responses.
- If
emulate_redis_responsesistrue, returns the number of existing fields in the hash that were removed by this command. - If
emulate_redis_responsesisfalse, returns OK.
Examples
-
emulate_redis_responsesistrue.$ HSET yugahash moon "Moon"1$ HDEL yugahash moon1$ HDEL yugahash moon0 -
emulate_redis_responsesisfalse.$ HSET yugahash moon "Moon""OK"$ HDEL yugahash moon"OK"$ HDEL yugahash moon"OK"
See also
hexists, hget, hgetall, hkeys, hlen, hmget, hmset, hset, hincrby, hstrlen, hvals