(mongodb >=1.4.0)
MongoDB\Driver\Manager::executeReadWriteCommand — Execute a database command that reads and writes
$db, MongoDB\Driver\Command $command, ?array $options = null): MongoDB\Driver\CursorExecutes the command on the primary server.
This method will apply logic that is specific to commands that read and write
(e.g. » aggregate).
Default values for the "readConcern" and
"writeConcern" options will be inferred from an active
transaction (indicated by the "session" option), followed
by the connection URI.
db (string)Назва бази даних, в якій буде виконано команду.
command (MongoDB\Driver\Command)Команда, яку потрібно виконати.
options
| Option | Type | Description |
|---|---|---|
| readConcern | MongoDB\Driver\ReadConcern |
Вимога щодо зчитування. Цей параметр доступний в MongoDB 3.2+, тож його застосування у старіших версіях викине виключення під час виконання. |
| session | MongoDB\Driver\Session |
Сеанс, по'язаний з операцією. |
| writeConcern | MongoDB\Driver\WriteConcern |
Вимога щодо запису. |
Для сеансу ("session") транзакції, яка триває, не
можна задати параметр "readConcern" або
"writeConcern". Це призведе до викидання виключення
MongoDB\Driver\Exception\InvalidArgumentException.
Ці два параметри потрібно задавати під час створення транзакції методом
MongoDB\Driver\Session::startTransaction().
У разі успіху повертає примірника MongoDB\Driver\Cursor.
"session" використано разом з параметром
"readConcern" або "writeConcern",
викидається
MongoDB\Driver\Exception\InvalidArgumentException."session", а вимога щодо запису не задоволена, викидається
MongoDB\Driver\Exception\InvalidArgumentException.
| Версія | Опис |
|---|---|
| PECL mongodb 1.4.4 |
MongoDB\Driver\Exception\InvalidArgumentException
will be thrown if the "session" option is used in
combination with an unacknowledged write concern.
|