# HMGET

> Get the values of several hash fields in one call.

URL: https://docs.hotkv.com/commands/hmget/

```
HMGET key field [field ...]
```

- Group: Hash
- Complexity: O(N) where N is the number of fields requested
- HotKV Cloud: all plans
- On-Premise: no license needed

`HMGET` returns the values of the given fields of the hash at `key`, in the
order you asked for them. A field that does not exist (or whose time to live
has passed) gives a nil in its position. A missing key behaves like an empty
hash.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Success | Array with one entry per field: bulk string, or nil bulk string for a missing field | Array of bulk strings, with null for a missing field |

`HMGET` replies with a `WRONGTYPE` error if `key` holds a value that is not a
hash.

## Examples

```
127.0.0.1:6379> HSET user:1 name "Ada" lang "en"
(integer) 2
127.0.0.1:6379> HMGET user:1 name email lang
1) "Ada"
2) (nil)
3) "en"
```

## Compatibility

Same as Redis 7.4 and Valkey 8.

## See also

[HGET](https://docs.hotkv.com/commands/hget/index.md), [HGETALL](https://docs.hotkv.com/commands/hgetall/index.md), [HGETEX](https://docs.hotkv.com/commands/hgetex/index.md),
[HGETDEL](https://docs.hotkv.com/commands/hgetdel/index.md), [MGET](https://docs.hotkv.com/commands/mget/index.md)