/** * Returns the DriverCursor considering the documents that have already * been retrieved from cache. * * @return Traversable */ protected function getOriginalCursor() : Traversable { if ($this->ignoreCache) { return parent::getCursor(); } if ($this->getLimit()) { $this->params[1]['limit'] = $this->getLimit() - $this->position; } $skipped = $this->params[1]['skip'] ?? 0; $this->skip($skipped + $this->position - 1); $this->ignoreCache = true; return $this->getOriginalCursor(); }