array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'mongodb-driver-manager.startsession.php', 1 => 'MongoDB\\Driver\\Manager::startSession', ), 'up' => array ( 0 => 'class.mongodb-driver-manager.php', 1 => 'MongoDB\\Driver\\Manager', ), 'prev' => array ( 0 => 'mongodb-driver-manager.selectserver.php', 1 => 'MongoDB\\Driver\\Manager::selectServer', ), 'next' => array ( 0 => 'class.mongodb-driver-command.php', 1 => 'MongoDB\\Driver\\Command', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/mongodb/driver/manager/startsession.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(mongodb >=1.4.0)
MongoDB\Driver\Manager::startSession — Start a new client session for use with this client
Creates a MongoDB\Driver\Session for the given options. The session may then be specified when executing commands, queries, and write operations.
Note: A MongoDB\Driver\Session can only be used with the MongoDB\Driver\Manager from which it was created.
options
Option | Type | Description | Default | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
causalConsistency | bool |
Configure causal consistency in a session. If See » Casual Consistency in the MongoDB manual for more information. |
true |
|||||||||||||||
defaultTransactionOptions | array |
Default options to apply to newly created transactions. These options are used unless they are overridden when a transaction is started with different value for each option.
This option is available in MongoDB 4.0+. |
[] |
|||||||||||||||
snapshot | bool |
Configure snapshot reads in a session. If
Snapshot reads require MongoDB 5.0+ and cannot be used with causal
consistency, transactions, or write operations. If
See » Read Concern "snapshot" in the MongoDB manual for more information. |
false |
Returns a MongoDB\Driver\Session.
"causalConsistency"
and "snapshot"
options are both true
.
Version | Description |
---|---|
PECL mongodb 1.11.0 |
The |
PECL mongodb 1.6.0 |
The |
PECL mongodb 1.5.0 |
The |