zrevrange #
Identical to zrange, except that the sorted set is traversed in descending order.
zrevrange(key, start, stop, [options], [callback]) #
Arguments | Type | Description |
---|---|---|
key | string | Key identifier |
start | int | Start position in the set (index starts at position 0 ) |
stop | int | End position in the set |
options | JSON Object | Optional parameters |
callback | function | Callback |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Return Value #
Returns the MemoryStorage
object to allow chaining.
Callback Response #
Returns an array of objects, each containing the following properties:
member
: member value in the sorted setscore
: member associated score
Usage #
// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.zrevrange('key', 0, -1, function (err, members) {
// callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.zrevrangePromise('key', 0, -1)
.then(members => {
// resolved once the action has completed
});
Callback response:
[
{ "member": "baz", "score": 3 },
{ "member": "bar", "score": 2 },
{ "member": "foo", "score": 1 }
]
Edit this page on Github(opens new window)