public function rewind()
    {
        if ($this->cursor !== null) {
            $this->cursor->rewind();
            return;
        }

        $this->cursor = $this->collection
            ->getMongoCollection()
            ->find(
                $this->expression->toArray(),
                $this->projection
            );

        if ($this->skip) {
            $this->cursor->skip($this->skip);
        }

        if ($this->limit) {
            $this->cursor->limit($this->limit);
        }

        if ($this->options['batchSize']) {
            $this->cursor->batchSize($this->options['batchSize']);
        }

        if ($this->options['clientTimeout']) {
            $this->cursor->timeout($this->options['clientTimeout']);
        }

        if ($this->options['serverTimeout']) {
            $this->cursor->maxTimeMS($this->options['clientTimeout']);
        }

        if (!empty($this->sort)) {
            $this->cursor->sort($this->sort);
        }

        if ($this->hint) {
            $this->cursor->hint($this->hint);
        }

        // define read preferences
        if (!empty($this->readPreference)) {
            $this->cursor->setReadPreference(
                $this->readPreference['type'],
                $this->readPreference['tagsets']
            );
        }

        // init cursor state
        $this->cursor->rewind();
    }
public function rewind()
    {
        if ($this->cursor !== null) {
            $this->cursor->rewind();
            return;
        }

        $this->cursor = $this->collection
            ->getMongoCollection()
            ->find(
                $this->expression->toArray(),
                $this->projection
            );

        if ($this->skip) {
            $this->cursor->skip($this->skip);
        }

        if ($this->limit) {
            $this->cursor->limit($this->limit);
        }

        if ($this->options['batchSize']) {
            $this->cursor->batchSize($this->options['batchSize']);
        }

        if ($this->options['clientTimeout']) {
            $this->cursor->timeout($this->options['clientTimeout']);
        }

        if ($this->options['serverTimeout']) {
            $this->cursor->maxTimeMS($this->options['clientTimeout']);
        }

        if (!empty($this->sort)) {
            $this->cursor->sort($this->sort);
        }

        if ($this->hint) {
            $this->cursor->hint($this->hint);
        }

        // define read preferences
        if (!empty($this->readPreference)) {
            $this->cursor->setReadPreference(
                $this->readPreference['type'],
                $this->readPreference['tagsets']
            );
        }

        // init cursor state
        $this->cursor->rewind();
    }
public function rewind ( ) { if ( $ this -> cursor !== null ) { $ this -> cursor -> rewind ( ) ; return ; } $ this -> cursor = $ this -> collection -> getMongoCollection ( ) -> find ( $ this -> expression -> toArray ( ) , $ this -> projection ) ; if ( $ this -> skip ) { $ this -> cursor -> skip ( $ this -> skip ) ; } if ( $ this -> limit ) { $ this -> cursor -> limit ( $ this -> limit ) ; } if ( $ this -> options [ 'batchSize' ] ) { $ this -> cursor -> batchSize ( $ this -> options [ 'batchSize' ] ) ; } if ( $ this -> options [ 'clientTimeout' ] ) { $ this -> cursor -> timeout ( $ this -> options [ 'clientTimeout' ] ) ; } if ( $ this -> options [ 'serverTimeout' ] ) { $ this -> cursor -> maxTimeMS ( $ this -> options [ 'clientTimeout' ] ) ; } if ( ! empty ( $ this -> sort ) ) { $ this -> cursor -> sort ( $ this -> sort ) ; } if ( $ this -> hint ) { $ this -> cursor -> hint ( $ this -> hint ) ; } // define read preferences if ( ! empty ( $ this -> readPreference ) ) { $ this -> cursor -> setReadPreference ( $ this -> readPreference [ 'type' ] , $ this -> readPreference [ 'tagsets' ] ) ; } // init cursor state $ this -> cursor -> rewind ( ) ; }
Returns the cursor to the beginning of the result set.
@return void
Returns the cursor to the beginning of the result set .