(mongodb >=1.4.0)
MongoDB\Driver\Manager::startSession — Start a new client session for use with this client
$options = ?): MongoDB\Driver\SessionCreates a MongoDB\Driver\Session for the given options. The session may then be specified when executing commands, queries, and write operations.
注意: 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+. | [] | 
Returns a MongoDB\Driver\Session.
| 版本 | 说明 | 
|---|---|
| PECL mongodb 1.6.0 | 
         The  | 
| PECL mongodb 1.5.0 | 
         The  |