GoLang MongoCollection::setWriteConcern

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



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

PHP MongoCollection::setWriteConcern

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

MongoCollection::setWriteConcern

(PECL mongo >=1.5.0)

MongoCollection::setWriteConcernSet the write concern for this database

Description

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

Parameters

w

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").

wtimeout

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

Return Values

Returns TRUE on success, or FALSE otherwise.

Errors/Exceptions

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

Examples

Example #1 MongoDB::setWriteConcern() example

<?php

$mc 
= new MongoClient('mongodb://rs1.example.com,rs2.example.com');
$coll $mc->selectCollection('test''foo');

// Require that the majority of servers in the replica set acknowledge writes
// within three seconds.
$coll->setWriteConcern('majority'3000);
?>

See Also