(mongodb >=1.5.0)
MongoDB\Driver\Session::startTransaction — Starts a transaction
Starts a multi-document transaction associated with the session. At any given
time, you can have at most one open transaction for a session. After starting
a transaction, the session object must be passed to each operation via
the "session"
option (e.g.
MongoDB\Driver\Manager::executeBulkWrite()) in order
to associate that operation with the transaction.
Transactions can be committed through MongoDB\Driver\Session::commitTransaction(), and aborted with MongoDB\Driver\Session::abortTransaction(). Transactions are also automatically aborted when the session is closed from garbage collection or by explicitly calling MongoDB\Driver\Session::endSession().
options
Options can be passed as argument to this method. Each element in this
options array overrides the corresponding option from the
"defaultTransactionOptions"
option, if set when
starting the session with
MongoDB\Driver\Manager::startSession().
Option | Type | Description |
---|---|---|
maxCommitTimeMS | integer |
The maximum amount of time in milliseconds to allow a single
If specified, |
readConcern | MongoDB\Driver\ReadConcern |
Un asunto de escritura a aplicar a la operación. Esta opción está disponible en MongoDB 3.2+ y resultará en una excepción en tiempo de ejecución si es especificada para una versión de servidor más antigua. |
readPreference | MongoDB\Driver\ReadPreference |
Una preferencia de lectura a usar para seleccionar un servidor para la operación. |
writeConcern | MongoDB\Driver\WriteConcern |
Un asunto de escritura a aplicar a la operación. |
No devuelve ningún valor.
Versión | Descripción |
---|---|
PECL mongodb 1.6.0 |
The |