public function modify($update, $options = [], $db = null)
    {
        if (!empty($this->emulateExecution)) {
            return null;
        }

        $this->prepare();

        $collection = $this->getCollection($db);
        if (!empty($this->orderBy)) {
            $options['sort'] = $this->orderBy;
        }

        $options['fields'] = $this->select;
        return $collection->findAndModify($this->composeCondition(), $update, $options);
    }
public function modify($update, $options = [], $db = null)
    {
        if (!empty($this->emulateExecution)) {
            return null;
        }

        $this->prepare();

        $collection = $this->getCollection($db);
        if (!empty($this->orderBy)) {
            $options['sort'] = $this->orderBy;
        }

        $options['fields'] = $this->select;
        return $collection->findAndModify($this->composeCondition(), $update, $options);
    }
public function modify ( $ update , $ options = [ ] , $ db = null ) { if ( ! empty ( $ this -> emulateExecution ) ) { return null ; } $ this -> prepare ( ) ; $ collection = $ this -> getCollection ( $ db ) ; if ( ! empty ( $ this -> orderBy ) ) { $ options [ 'sort' ] = $ this -> orderBy ; } $ options [ 'fields' ] = $ this -> select ; return $ collection -> findAndModify ( $ this -> composeCondition ( ) , $ update , $ options ) ; }
Performs 'findAndModify' query and returns a single row of result.
@param array $update update criteria
@param array $options list of options in format: optionName => optionValue.
@param Connection $db the Mongo connection used to execute the query.
@return array|null the original document, or the modified document when $options['new'] is set.
Performs findAndModify query and returns a single row of result .