MongoDB\Driver\Manager
PHP Manual

MongoDB\Driver\Manager::startSession

(mongodb >=1.4.0)

MongoDB\Driver\Manager::startSessionStart a new client session for use with this client

Description

final public MongoDB\Driver\Session MongoDB\Driver\Manager::startSession ([ array $options ] )

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.

Liste de paramètres

options

options
Option Type Description Default
causalConsistency boolean

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 to FALSE 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
readConcern MongoDB\Driver\ReadConcern

Une préoccupation de lecture à appliquer à l'opération.

Cette option est disponible dans MongoDB 3.2+ et se traduira par une exception au moment de l'exécution si elle est spécifiée pour une version plus ancienne du serveur.

readPreference MongoDB\Driver\ReadPreference

Une préférence de lecture à utiliser pour sélectionner un serveur pour l'opération.

writeConcern MongoDB\Driver\WriteConcern

Une préoccupation d'écriture à appliquer à l'opération.

This option is available in MongoDB 4.0+.

[]

Valeurs de retour

Returns a MongoDB\Driver\Session.

Erreurs / Exceptions

Historique

Version Description
1.5.0

The "defaultTransactionOptions" option was added.

Voir aussi


MongoDB\Driver\Manager
PHP Manual