Core 2.x

zremrangebylex

Removes members within a provided range, from a sorted set where all elements have the same score, using lexicographical ordering.

[Redis documentation]

Arguments

Copied to clipboard!
zremrangebylex(key, [options]);

Arguments Type Description
key
string
Sorted set key
min
string
Minimum range value
max
string
Maximum range value
options
object
Optional query arguments

By default, the provided min and max values are inclusive. This behavior can be changed using the syntax described in the Redis ZRANGEBYLEX documentation.

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 removed members.

Usage

Copied to clipboard!
try {
  await kuzzle.ms.zadd('ssetfoo', [
    {member: 'foo', score: '0'},
    {member: 'bar', score: '0'},
    {member: 'baz', score: '0'}
  ]);
  await kuzzle.ms.zremrangebylex('ssetfoo', '[baz', '+');
  // Prints: [ 'bar' ]
  console.log(await kuzzle.ms.zrangebylex('ssetfoo', '-', '+'));
} catch (error) {
  console.error(error.message);
}