# TAG.MEMBERS

> Return all keys that carry a tag.

URL: https://docs.hotkv.com/commands/tag-members/

```
TAG.MEMBERS tag
```

- Group: Tags
- Complexity: O(n), n being the keys with the tag
- HotKV Cloud: all plans
- On-Premise: no license needed

`TAG.MEMBERS` returns every key name that carries `tag`. The order is not
defined.

Tags are shared by all logical databases, so a returned key may
live in a database other than the selected one. In cluster mode, the command
answers from the node you send it to.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Tag in use | Array of key names | Array of key names |
| Unknown tag | Empty array | Empty array |

## Examples

```
127.0.0.1:6379> MSET article:1 "..." article:2 "..."
OK
127.0.0.1:6379> TAG.SET article:1 news
(integer) 1
127.0.0.1:6379> TAG.SET article:2 news
(integer) 1
127.0.0.1:6379> TAG.MEMBERS news
1) "article:2"
2) "article:1"
```

The order of the keys can differ.

## Compatibility

HotKV-only command.

## See also

[TAG.INTER](https://docs.hotkv.com/commands/tag-inter/index.md), [TAG.SET](https://docs.hotkv.com/commands/tag-set/index.md), [TAG.GET](https://docs.hotkv.com/commands/tag-get/index.md)