# ZRANGE

> Returns the specified range of elements in the sorted set stored at key.

## Arguments 

<ParamField body="key" type="string" required>
  The key to get.
</ParamField>


<ParamField body="min" type="number | string" required>
  The lower bound of the range.
</ParamField>


<ParamField body="max" type="number | string" required>
  The upper bound of the range.
</ParamField>


<ParamField body="options"  >
<Expandable>
  <ParamField body="withScores" type="boolean">
    Whether to include the scores in the response.
  </ParamField>
  <ParamField body="rev" type="boolean">
    Whether to reverse the order of the response.
    </ParamField>
    <ParamField body="byScore" type="boolean">
    Whether to use the score as the sort order.
    </ParamField>
    <ParamField body="byLex" type="boolean">
    Whether to use lexicographical ordering.
    </ParamField>
    <ParamField body="offset" type="number">
    The offset to start from.
    </ParamField>
    <ParamField body="count" type="number">
    The number of elements to return.
    </ParamField>
    </Expandable>
</ParamField>

## Response

<ResponseField type="TMember[]">
    The values in the specified range.

    If `withScores` is true, the response will have interleaved members and scores: `[TMember, number, TMember, number, ...]`
</ResponseField>



<RequestExample>
```ts Example
await redis.zadd("key", 
    { score: 1, member: "m1" },
    { score: 2, member: "m2" },
)
const res = await redis.zrange("key", 1, 3)
console.log(res) // ["m2"]
```

```ts WithScores
await redis.zadd("key", 
    { score: 1, member: "m1" },
    { score: 2, member: "m2" },
)
const res = await redis.zrange("key", 1, 3, { withScores: true })
console.log(res) // ["m2", 2]
```

```ts ByScore
await redis.zadd("key", 
    { score: 1, member: "m1" },
    { score: 2, member: "m2" },
    { score: 3, member: "m3" },
)
const res = await redis.zrange("key", 1, 2, { byScore: true })
console.log(res) // ["m1", "m2"]
```
</RequestExample>
