> For the complete documentation index, see [llms.txt](https://aiii-mike.gitbook.io/redis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aiii-mike.gitbook.io/redis/command/set/smembers.md).

# smembers

### 1. 基本語法

#### smember&#x73;**(`key`, `callback`)**&#x20;

取得集合內的所有成員。

### **2. 範例**

{% tabs %}
{% tab title="TypeScript" %}

```typescript
client.del('food');

const arr = ['apple', 'potato', 'apple', 'onion', 'potato', 'onion']
client.sadd('food', arr);
client.smembers('food', (err, members) => {
    console.log(members);
});
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output-TS" %}

```
[ 'apple', 'onion', 'potato' ]
```

{% endtab %}
{% endtabs %}
