# zscan

### 1. 基本語法

#### zsca&#x6E;**(`key`,  `cursor`, `['MATCH', pattern]`, `['COUNT', count]`,`callback`)**&#x20;

集合中。

| Parameter   | Default  |
| ----------- | -------- |
| **pattern** | **"\*"** |
| **count**   | **"10"** |

### **2. 範例**

**(1)**&#x20;

{% tabs %}
{% tab title="TypeScript" %}
```typescript
client.del('zset:1');

const key1 = 'zset:1'
const members1 = ['A', 'B', 'C', 'a', 'b', 'c'];
const scores1 = [-2, -1, 0, 0, 1, 2];

members1.forEach((mem, ind) => {
    client.zadd(key1, scores1[ind], mem);
})

let cursor = '0';
client.zscan(key1, cursor, (err, scanner) => {
        cursor = scanner[0];
        let sub_zset = scanner[1];
        console.log('Cursor: ', cursor);
        console.log('Members: ', sub_zset);
    }
);

```
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output-TS" %}
```
Cursor:  0
Members:  ['A', '-2', 'B', '-1', 'C', '0', 'a', '0', 'b', '1', 'c', '2']
```
{% endtab %}
{% endtabs %}



