- API Documentation >
- MongoDB\Client Class >
- MongoDB\Client::startSession()
MongoDB\Client::startSession()
New in version 1.3.
On this page
Definition
-
MongoDB\Client::startSession
Start a new client session for use with this client.
Refer to the MongoDB\Driver\Manager::startSession() extension reference for accepted options.
Return Values
A MongoDBDriverSession object.
Errors/Exceptions
MongoDB\Driver\Exception\InvalidArgumentException for errors related to the parsing of parameters or options at the driver level.
MongoDB\Driver\Exception\RuntimeException for other errors at the driver level (e.g. connection errors).
Example
The following example starts a new session:
The output would then resemble:
See Also
- MongoDB\Driver\Manager::startSession()
- Causal Consistency in the MongoDB manual