Manager
final class Manager (View source)
The MongoDB\Driver\Manager is the main entry point to the extension. It is responsible for maintaining connections to MongoDB (be it standalone server, replica set, or sharded cluster).
No connection to MongoDB is made upon instantiating the Manager. This means the MongoDB\Driver\Manager can always be constructed, even though one or more MongoDB servers are down. Any write or query can throw connection exceptions as connections are created lazily. A MongoDB server may also become unavailable during the life time of the script. It is therefore important that all actions on the Manager to be wrapped in try/catch statements.
Methods
Manager constructor.
No description
Return a ClientEncryption instance.
Execute one or more write operations
Execute a MongoDB query
Return the encryptedFieldsMap auto encryption option for the Manager
Return the ReadConcern for the Manager
Return the ReadPreference for the Manager
Return the servers to which this manager is connected
Return the WriteConcern for the Manager
Preselect a MongoDB node based on provided readPreference. This can be useful to guarantee a command runs on a specific server when operating in a mixed version cluster.
Start a new client session for use with this client
Unregisters a monitoring event subscriber with this Manager
Details
final
__construct(string|null $uri = null, array|null $uriOptions = null, array|null $driverOptions = null)
Manager constructor.
final
__wakeup()
No description
final ClientEncryption
createClientEncryption(array $options)
Return a ClientEncryption instance.
final WriteResult
executeBulkWrite(string $namespace, BulkWrite $bulk, WriteConcern|null $options = null)
Execute one or more write operations
final Cursor
executeCommand(string $db, Command $command, ReadPreference|null $options = null)
No description
final Cursor
executeQuery(string $namespace, Query $query, ReadPreference|null $options = null)
Execute a MongoDB query
final Cursor
executeReadCommand(string $db, Command $command, array|null $options = null)
No description
final Cursor
executeReadWriteCommand(string $db, Command $command, array|null $options = null)
No description
final Cursor
executeWriteCommand(string $db, Command $command, array|null $options = null)
No description
final array|object|null
getEncryptedFieldsMap()
Return the encryptedFieldsMap auto encryption option for the Manager
final ReadConcern
getReadConcern()
Return the ReadConcern for the Manager
final ReadPreference
getReadPreference()
Return the ReadPreference for the Manager
final array
getServers()
Return the servers to which this manager is connected
final WriteConcern
getWriteConcern()
Return the WriteConcern for the Manager
final Server
selectServer(ReadPreference|null $readPreference = null)
Preselect a MongoDB node based on provided readPreference. This can be useful to guarantee a command runs on a specific server when operating in a mixed version cluster.
https://secure.php.net/manual/en/mongodb-driver-manager.selectserver.php
final Session
startSession(array|null $options = null)
Start a new client session for use with this client
final void
addSubscriber(Subscriber $subscriber)
Registers a monitoring event subscriber with this Manager
final void
removeSubscriber(Subscriber $subscriber)
Unregisters a monitoring event subscriber with this Manager