Skip to main content

Documentation Index

Fetch the complete documentation index at: https://upstash.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Arguments

destination
string
required
The key to write the union to.
keys
integer
required
How many keys to compare.
keys
string | string[]
required
The keys to compare.
options
aggregate
sum | min | max
The aggregation method.
weight
number
The weight to apply to each key.
weights
number[]
The weights to apply to each key.

Response

The number of elements in the resulting set.
await redis.zadd(
    "key1", 
    { score: 1, member: "member1" },
)
await redis.zadd(
    "key2",
    { score: 1, member: "member1" },
    { score: 2, member: "member2" },
)

const res = await redis.zunionstore("destination", 2, ["key1", "key2"]);
console.log(res) // 2