protected function ensureIterator()
{
if ($this->iterator === null) {
// MongoDB\Driver\Cursor needs to be wrapped into a \Generator so that a valid \Iterator with working implementations of
// next, current, valid, key and rewind is returned. These methods don't work if we wrap the Cursor inside an \IteratorIterator
$this->iterator = $this->wrapTraversable($this->ensureCursor());
}
return $this->iterator;
}