Core
API v2.x
2

zrevrange #

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

[Redis documentation]


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/ms/_zrevrange/<_id>?start=<index start>&stop=<index stop>[&options=withscores]
Method: GET

Other protocols #

Copied to clipboard!
{
  "controller": "ms",
  "action": "zrevrange",
  "_id": "<key>",
  "start": "<index start>",
  "stop": "<index stop>",
  // optional
  "options": ["withscores"]
}

Arguments #

  • _id: sorted set identifier
  • start: starting position index, inclusive
  • stop: ending position index, inclusive

Optional: #

  • withscores: return the score alongside the found elements

Response #

By default, returns the list of elements in the provided index range:

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "zrange",
  "collection": null,
  "index": null,
  "result": [
    "...",
    "element2",
    "element1"
  ]
}

If the withscores option is provided, then the returned array alternates elements with their score:

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "zrange",
  "collection": null,
  "index": null,
  "result": [
    "...",
    "element2",
    "score of element2",
    "element1",
    "score of element1"
  ]
}