4

Arangodb has a LIMIT and SKIP function for simple queries, how would one implement using /api/cursor

FOR product in products
    LIMIT 2
return product

Ideally something like

FOR product in products
    LIMIT 20 SKIP 10
return product

Or it this only support using /_api/simple/all calls

isawk
  • 969
  • 8
  • 21

1 Answers1

6

Think I figured it out, the LIMIT clause has an offset, count, that can be used to skip and implement pagination.

LIMIT @offset, @count

FOR product in products
    LIMIT 2, 10
return product
isawk
  • 969
  • 8
  • 21
  • To add a little bit of explanation: `LIMIT` comes in two forms, `LIMIT count` to return up to `count` documents and `LIMIT offset, count` to skip `offset` documents and return no more than `count` documents. You can think of the former as a shorthand for `LIMIT 0, count` (don't skip any documents, then return `count` documents tops). https://docs.arangodb.com/Aql/Operations.html#limit – CodeManX Aug 27 '15 at 16:09