Mzdiff
Bun

method

RedisClient.zdiff

numkeys: number,
...args: [...keys: KeyLike[], withscores: 'WITHSCORES']
): Promise<[string, number][]>;

Compute the difference between sorted sets with scores

@param numkeys

The number of sorted set keys

@returns

Promise that resolves with an array of [member, score] pairs

await redis.send("ZADD", ["zset1", "1", "one", "2", "two", "3", "three"]);
await redis.send("ZADD", ["zset2", "1", "one", "2", "two"]);
const diff = await redis.zdiff(2, "zset1", "zset2", "WITHSCORES");
console.log(diff); // ["three", "3"]
numkeys: number,
...keys: KeyLike[]
): Promise<string[]>;

Compute the difference between the first sorted set and all successive sorted sets

Returns the members of the sorted set resulting from the difference between the first sorted set and all the successive sorted sets. The first key is the only one used to compute the members of the difference.

@param numkeys

The number of sorted set keys

@param keys

The sorted set keys to compare

@returns

Promise that resolves with an array of members

await redis.send("ZADD", ["zset1", "1", "one", "2", "two", "3", "three"]);
await redis.send("ZADD", ["zset2", "1", "one", "2", "two"]);
const diff = await redis.zdiff(2, "zset1", "zset2");
console.log(diff); // ["three"]

Referenced types

type KeyLike = string | ArrayBufferView | Blob