public function replaceOne($filter, $replacement, array $options = [])
    {
        if ( ! isset($options['writeConcern'])) {
            $options['writeConcern'] = $this->writeConcern;
        }

        $operation = new ReplaceOne($this->databaseName, $this->collectionName, $filter, $replacement, $options);
        $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));

        return $operation->execute($server);
    }
public function replaceOne($filter, $replacement, array $options = [])
    {
        if ( ! isset($options['writeConcern'])) {
            $options['writeConcern'] = $this->writeConcern;
        }

        $operation = new ReplaceOne($this->databaseName, $this->collectionName, $filter, $replacement, $options);
        $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));

        return $operation->execute($server);
    }
public function replaceOne ( $ filter , $ replacement , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new ReplaceOne ( $ this -> databaseName , $ this -> collectionName , $ filter , $ replacement , $ options ) ; $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; return $ operation -> execute ( $ server ) ; }
Replaces at most one document matching the filter.

@see ReplaceOne::__construct() for supported options
@see http://docs.mongodb.org/manual/reference/command/update/
@param array|object $filter      Query by which to filter documents
@param array|object $replacement Replacement document
@param array        $options     Command options
@return UpdateResult
@throws UnsupportedException if options are not supported by the selected server
@throws InvalidArgumentException for parameter/option parsing errors
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Replaces at most one document matching the filter .