MongoDB\Driver\Session::commitTransaction
(mongodb >=1.5.0)
MongoDB\Driver\Session::commitTransaction — Commits a transaction
说明
Saves the changes made by the operations in the multi-document transaction and ends the transaction. Until the commit, none of the data changes made from within the transaction are visible outside the transaction.
参数
此函数没有参数。
返回值
没有返回值。
错误/异常
- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
 - Throws
   MongoDB\Driver\Exception\CommandException if the
   server could not commit the transaction (e.g. due to conflicts, network
   issues). In case the exception's
   MongoDB\Driver\Exception\CommandException::getResultDocument()
   has a 
"errorLabels"element, and this array contains a"TransientTransactionError"or"UnknownTransactionCommitResult"value, it is safe to re-try the whole transaction. In newer versions of the extension, MongoDB\Driver\Exception\RuntimeException::hasErrorLabel() should be used to test for this situation instead. - Throws MongoDB\Driver\Exception\RuntimeException if the transaction could not be commited (e.g. a transaction was not started).
 
参见
- MongoDB\Driver\Manager::startSession() - Start a new client session for use with this client
 - MongoDB\Driver\Session::abortTransaction() - Aborts a transaction
 - MongoDB\Driver\Session::startTransaction() - Starts a transaction
 - MongoDB\Driver\Exception\RuntimeException::hasErrorLabel() - Returns whether an error label is associated with an exception
 
  +添加备注
  
 用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/mongodb-driver-session.committransaction.php