The question is what next documents should actually mean.
If the next here means document key index order:
A document has no particular "order" or "index" inside a collection. Documents in a collection are organized by their _key
/ _id
attribute in the unsorted primary index.
To get to the next document key (let's assume lexicographically sorted keys) one would have to read all keys of the collection, sort them and somehow find the index of the current document to get to the next key. This would be terribly inefficient.
Other indexes on a collection are optional so one cannot rely on them being present and being usable for such query.
If next here means insertion or update order, then there is also no sensible way to get to the next documents.
A workaround may be to use a sorted (i.e. skiplist) index on some document attribute, ideally a unique one, and populate it whenever whenever a document is inserted (and maybe updated if updates should also change the order of a document).
Then to find the next documents, do this:
first find the desired document by its _id
or _key
and fetch the document data into the application
fetch the document attribute that has the sorted index on it, and use it in a follow-up AQL query as follows
This will allow you to find the documents following the original one, however, you have to maintain the order attribute somehow:
FOR doc IN collection
FILTER doc.`order` > @value
LIMIT 0, 30
RETURN doc
This will be easy to do if your documents have some attribute that can be used for ordering anyway, but it will be a clumsy solution if they don't have such attribute.