GoLang MongoClient::setWriteConcern

request it (188)
GoLang replacement for PHP's MongoClient::setWriteConcern [edit | history]

Do you know a GoLang replacement for PHP's MongoClient::setWriteConcern? Write it!

PHP MongoClient::setWriteConcern

PHP original manual for MongoClient::setWriteConcern [ show | php.net ]


(PECL mongo >=1.5.0)

MongoClient::setWriteConcernSet the write concern for this connection

This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension.


public bool MongoClient::setWriteConcern ( mixed $w [, int $wtimeout ] )



The write concern. This may be an integer denoting the number of servers required to acknowledge the write, or a string mode (e.g. "majority").


The maximum number of milliseconds to wait for the server to satisfy the write concern.

Return Values

Returns TRUE on success, or FALSE otherwise.


Emits E_WARNING if the w parameter is not an integer or string value.


Example #1 MongoClient::setWriteConcern() example


= new MongoClient('mongodb://rs1.example.com,rs2.example.com');

// Require that the majority of servers in the replica set acknowledge writes
// within three seconds.

See Also