Closed ir0nCr055 closed 9 months ago
Cursors that are split over multiple batches are identified by a batch ID so fetching additional batches does not require the use of trx.step
(but it won't hurt). This is an implementation detail of ArangoDB.
I've added a note to the db.query
documentation to clarify that the step
method is not necessary to consume the cursor.
Aside from a brief mention of
db.query
in this source code comment I couldn't find any explicit documentation on how someone could run AQL queries as part of a stream transaction using arangojs.Given the subtleties of the
Transaction
'sstep()
API it would be extremely helpful if there were at least one full example showing how this could be achieved according to best practices (usingtrx.step
withdb.query
,curor.next
,cursor.all
, etc.).I assume there are legit cases where mixing AQL queries with
Collection
API calls inside a stream transaction could address known AQL limitations.For the sake of this Github issue, here's a (admittedly weak) example showing how a stream transaction could be used to configure fine-grained collection access for an AQL query (or maybe I'm doing it wrong. :) )