sdiffstore

Computes the difference between a reference set of unique values, and other sets. The differences are then stored in the provided destination key.

If the destination key already exists, it is overwritten.

[Redis documentation]

Arguments

Copied to clipboard!
sdiffstore(ref, sets, dest, [options]);

Arguments Type Description
ref
string
Set key of reference
sets
string[]
List of sets to compare to the reference
dest
string
Destination key
options
object
Optional query arguments

options

The options arguments can contain the following option properties:

Property Type (default) Description
queuable
boolean (true)
If true, queues the request during downtime, until connected to Kuzzle again

Resolve

Resolves to the number of values stored at the new key.

Usage

Copied to clipboard!
try {
  await kuzzle.ms.sadd('ref', ['foo', 'bar', 'baz']);

  await kuzzle.ms.sadd('set1', ['foo', 'hello']);
  await kuzzle.ms.sadd('set2', ['bar', 'world']);

  await kuzzle.ms.sdiffstore('ref', ['set1', 'set2'], 'diffs');

  // Prints: [ 'baz' ]
  console.log(await kuzzle.ms.smembers('diffs'));
} catch (error) {
  console.error(error.message);
}