lib/CosmoW/Riak/Collection.php
protected function doFindAndUpdate(array $query, array $newObj, array $options)
    {
        list($commandOptions, $clientOptions) = isset($options['socketTimeoutMS']) || isset($options['timeout'])
            ? $this->splitCommandAndClientOptions($options)
            : array($options, array());

        $command = array();
        $command['findandmodify'] = $this->riakCollection->getName();
        $command['query'] = (object) $query;
        $command['update'] = (object) $newObj;
        $command = array_merge($command, $commandOptions);

        $result = $this->database->command($command, $clientOptions);

        if (empty($result['ok'])) {
            throw new ResultException($result);
        }

        return isset($result['value']) ? $result['value'] : null;
    }
protected function doFindAndUpdate(array $query, array $newObj, array $options)
    {
        list($commandOptions, $clientOptions) = isset($options['socketTimeoutMS']) || isset($options['timeout'])
            ? $this->splitCommandAndClientOptions($options)
            : array($options, array());

        $command = array();
        $command['findandmodify'] = $this->riakCollection->getName();
        $command['query'] = (object) $query;
        $command['update'] = (object) $newObj;
        $command = array_merge($command, $commandOptions);

        $result = $this->database->command($command, $clientOptions);

        if (empty($result['ok'])) {
            throw new ResultException($result);
        }

        return isset($result['value']) ? $result['value'] : null;
    }
protected function doFindAndUpdate ( array $ query , array $ newObj , array $ options ) { list ( $ commandOptions , $ clientOptions ) = isset ( $ options [ 'socketTimeoutMS' ] ) || isset ( $ options [ 'timeout' ] ) ? $ this -> splitCommandAndClientOptions ( $ options ) : array ( $ options , array ( ) ) ; $ command = array ( ) ; $ command [ 'findandmodify' ] = $ this -> riakCollection -> getName ( ) ; $ command [ 'query' ] = ( object ) $ query ; $ command [ 'update' ] = ( object ) $ newObj ; $ command = array_merge ( $ command , $ commandOptions ) ; $ result = $ this -> database -> command ( $ command , $ clientOptions ) ; if ( empty ( $ result [ 'ok' ] ) ) { throw new ResultException ( $ result ) ; } return isset ( $ result [ 'value' ] ) ? $ result [ 'value' ] : null ; }
Execute the findAndModify command with the update option.

@see Collection::findAndUpdate()
@param array $query
@param array $newObj
@param array $options
@return array|null
@throws ResultException if the command fails
Execute the findAndModify command with the update option .