await redis.zadd("key", { score: 1, member: "a" }, { score: 2, member: "ab" }, { score: 3, member: "b" }, { score: 4, member: "c" }, { score: 5, member: "d" }, ) const [newCursor, members] = await redis.sscan("key", 0, { match: "a*"}); console.log(newCursor); // likely `0` since this is a very small set console.log(members); // ["a", "ab"]
Scan a sorted set
The key of the sorted set.
The cursor, use 0 in the beginning and then use the returned cursor for subsequent calls.
0
Glob-style pattern to filter by members.
Number of members to return per call.
The new cursor and the members. If the new cursor is 0 the iteration is complete.
Was this page helpful?