MongoClient
PHP Manual

MongoClient::setWriteConcern

(PECL mongo >=1.5.0)

MongoClient::setWriteConcernSet the write concern for this connection

説明

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

パラメータ

w

書き込み確認。何台のサーバーに書き込めたら成功とみなすのかを表す整数値、あるいは文字列 ("majority" など) でモードを指定します。

wtimeout

サーバーが書き込み確認を待つ最大ミリ秒数。

返り値

成功した場合に TRUE、それ以外の場合に FALSE を返します。

エラー / 例外

w が整数値あるいは文字列でない場合に E_WARNING が発生します。

例1 MongoClient::setWriteConcern() example

<?php

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

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

参考


MongoClient
PHP Manual