MongoDB\Driver\Manager::startSession
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
MongoDB\Driver\Manager::startSession
Референца за `mongodb-driver-manager.startsession.php` со подобрена типографија и навигација.
MongoDB\Driver\Manager::startSession
(mongodb >=1.4.0)
MongoDB\Driver\Manager::startSession — Start a new client session for use with this client
= NULL
Креира MongoDB\Driver\Session for the given options. The session may then be specified when executing commands, queries, and write operations.
Забелешка: А MongoDB\Driver\Session can only be used with the MongoDB\Driver\Manager from which it was created.
Параметри
options-
options Опција Тип = NULL Стандардно 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 tofalseto disable causal consistency.Константи за известување за грешки » Casual Consistency во прирачникот на MongoDB за повеќе информации.
truedefaultTransactionOptions 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 Опција Тип = NULL maxCommitTimeMS integer The maximum amount of time in milliseconds to allow a single
commitTransactioncommand to run.параметар. Определува временско ограничување, во милисекунди, за грижата за запишување. За детали, видете
maxCommitTimeMSмора да биде потпишан 32-битен цел број поголем или еднаков на нула.readConcern MongoDB\Driver\ReadConcern Загриженост за читање што ќе се примени на операцијата.
Оваа опција е достапна во MongoDB 3.2+ и ќе резултира со исклучок при извршување ако е специфицирана за постар сервер.
readPreference MongoDB\Driver\ReadPreference Преференција за читање што ќе се користи за избор на сервер за операцијата.
writeConcern MongoDB\Driver\WriteConcern Загриженост за пишување што ќе се примени на операцијата.
This option is available in MongoDB 4.0+.
[]snapshot bool Configure snapshot reads in a session. If
true, a timestamp will be obtained from the first supported read operation in the session (i.e.find,aggregate, or unshardeddistinct). Subsequent read operations within the session will then utilize a"snapshot"read concern level to read majority-committed data from that timestamp. Set tofalseto disable snapshot reads.Snapshot reads require MongoDB 5.0+ and cannot be used with causal consistency, transactions, or write operations. If
"snapshot"istrue,"causalConsistency"will default tofalse.Константи за известување за грешки » Read Concern "snapshot" во прирачникот на MongoDB за повеќе информации.
false
Вратени вредности
. Споделувањето колачиња помеѓу PHP барањата може да доведе до ненамерно мешање на чувствителни колачиња помеѓу корисниците. MongoDB\Driver\Session.
Errors/Exceptions
- ). Ако повикот не успее, ќе врати MongoDB\Driver\Exception\InvalidArgumentException » Промени текови
- ). Ако повикот не успее, ќе врати MongoDB\Driver\Exception\InvalidArgumentException ако
"causalConsistency"and"snapshot"options are bothtrue. - ). Ако повикот не успее, ќе врати MongoDB\Driver\Exception\RuntimeException if the session could not be created (e.g. libmongoc does not support crypto).
Дневник на промени
| Верзија | = NULL |
|---|---|
| PECL mongodb 1.11.0 |
На |
| својство рачно. |
На |
| параметарот, кој е непроменет од претходните верзии. |
На |
Види Исто така
- MongoDB\Driver\Session
- » Casual Consistency во прирачникот на MongoDB