MongoClient::setWriteConcern
(PECL mongo >=1.5.0)
MongoClient::setWriteConcern — Set the write concern for this connection
Description
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 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);
?>
See Also
- The write concern documentation.
- MongoClient::getWriteConcern() - Get the write concern for this connection
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- MongoDB
- Базовые классы
- Функция MongoClient::close() - Closes this connection
- Функция MongoClient::connect() - Connects to a database server
- Функция MongoClient::__construct() - Creates a new database connection object
- Функция MongoClient::dropDB() - Drops a database [deprecated]
- Функция MongoClient::__get() - Gets a database
- Функция MongoClient::getConnections() - Return info about all open connections
- Функция MongoClient::getHosts() - Updates status for all associated hosts
- Функция MongoClient::getReadPreference() - Get the read preference for this connection
- Функция MongoClient::getWriteConcern() - Get the write concern for this connection
- Функция MongoClient::killCursor() - Kills a specific cursor on the server
- Функция MongoClient::listDBs() - Lists all of the databases available.
- Функция MongoClient::selectCollection() - Gets a database collection
- Функция MongoClient::selectDB() - Gets a database
- Функция MongoClient::setReadPreference() - Set the read preference for this connection
- Функция MongoClient::setWriteConcern() - Set the write concern for this connection
- Функция MongoClient::__toString() - String representation of this connection
Коментарии
404 Not Found