diff --git a/arangod/VocBase/SingleServerTraverser.cpp b/arangod/VocBase/SingleServerTraverser.cpp index a7072a6ea5..0954efe37c 100644 --- a/arangod/VocBase/SingleServerTraverser.cpp +++ b/arangod/VocBase/SingleServerTraverser.cpp @@ -121,7 +121,10 @@ bool SingleServerEdgeCursor::next(std::vector& result, // If we switch the cursor. We have to clear the cache. _cache.clear(); } else { - cursor->getMoreTokens(_cache, 1000); + auto cb = [&] (DocumentIdentifierToken const& token) { + _cache.emplace_back(token); + }; + cursor->getMore(cb, 1000); } } while (_cache.empty()); @@ -155,15 +158,12 @@ bool SingleServerEdgeCursor::readAll(std::unordered_set& result, auto& cursorSet = _cursors[_currentCursor]; for (auto& cursor : cursorSet) { LogicalCollection* collection = cursor->collection(); - while (cursor->hasMore()) { - // NOTE: We cannot clear the cache, - // because the cursor expect's it to be filled. - cursor->getMoreTokens(_cache, 1000); - for (auto const& element : _cache) { - if (collection->readDocument(_trx, *_mmdr, element)) { - result.emplace(_mmdr->vpack()); - } + auto cb = [&] (DocumentIdentifierToken const& token) { + if (collection->readDocument(_trx, *_mmdr, token)) { + result.emplace(_mmdr->vpack()); } + }; + while (cursor->getMore(cb, 1000)) { } } _currentCursor++;