SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

zrevrangebyscore #

Identical to zrangebyscore except that the sorted set is traversed in descending order.

[Redis documentation]


zrevrangebyscore(key, min, max, [options], [callback]) #

ArgumentsTypeDescription
keystringKey identifier
mindoubleMinimum score value (inclusive by default)
maxdoubleMaximum score value (inclusive by default)
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options #

OptionTypeDescriptionDefault
limitarrayLimit the result set to a range of matching elements (similar to SELECT LIMIT offset, count in SQL).
Format: [<offset(int)>, <count(int)>]
null
queuablebooleanMake this request queuable or nottrue

Return value #

Returns the MemoryStorage object to allow chaining.


Callback Response #

Returns an array of matching members.

Usage #

// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.zrevrangebyscore('key', 2, 3, function (err, members) {
  // callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.zrevrangebyscorePromise('key', 2, 3)
  .then(members => {
    // resolved once the action has completed
  });

Callback response:

[
  { "member": "baz", "score": 3 },
  { "member": "bar", "score": 2 },
  { "member": "foo", "score": 1 }
]