MongoDB\Driver\Manager::startSession
(mongodb >=1.4.0)
MongoDB\Driver\Manager::startSession — Start a new client session for use with this client
説明
final public MongoDB\Driver\Manager::startSession
([ array $options
] ) : MongoDB\Driver\Session
Creates 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
- {|
|+ options
!width="25%"| Option
!width="25%"| Type
!width="25%"| Description
!width="25%"| Default
|-
| causalConsistency
| bool
|
Configure causal consistency in a session. If
true
, each operation in the session will be causally ordered after the previous read or write operation. Set tofalse
to disable causal consistency.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.
options Option Type Description maxCommitTimeMS integer commitTransaction
コマンドが実行できる最大の時間をミリ秒単位で指定します指定する場合、
maxCommitTimeMS
は、符号付き32bit の整数より大きいか、0でなければなりませんreadConcern MongoDB\Driver\ReadConcern A read concern to apply to the operation.
This option is available in MongoDB 3.2+ and will result in an exception at execution time if specified for an older server version.
readPreference MongoDB\Driver\ReadPreference A read preference to use for selecting a server for the operation.
writeConcern MongoDB\Driver\WriteConcern A write concern to apply to the operation.
This option is available in MongoDB 4.0+.
|
[]
|}
エラー / 例外
- 引数のパースに失敗した場合に MongoDB\Driver\Exception\InvalidArgumentException をスローします。
- Throws MongoDB\Driver\Exception\RuntimeException if the session could not be created (e.g. libmongoc does not support crypto).
変更履歴
バージョン | 説明 |
---|---|
PECL mongodb 1.6.0 | The "maxCommitTimeMS" option was added to
|
PECL mongodb 1.5.0 | The "defaultTransactionOptions" option was added.
|