Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 39 and 311]

(no description)

File Size: 429 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Client  - X-Ref

__construct($uri = 'mongodb:)   X-Ref
Constructs a new Client instance.

This is the preferred class for connecting to a MongoDB server or
cluster of servers. It serves as a gateway for accessing individual
databases and collections.

Supported driver-specific options:

* typeMap (array): Default type map for cursors and BSON documents.

Other options are documented in MongoDB\Driver\Manager::__construct().

param: string $uri           MongoDB connection string
param: array  $uriOptions    Additional connection string options
param: array  $driverOptions Driver-specific options

__debugInfo()   X-Ref
Return internal properties for debugging purposes.

return: array

__get($databaseName)   X-Ref
Select a database.

Note: databases whose names contain special characters (e.g. "-") may
be selected with complex syntax (e.g. $client->{"that-database"}) or
{@link selectDatabase()}.

param: string $databaseName Name of the database to select
return: Database

__toString()   X-Ref
Return the connection string (i.e. URI).

return: string

createClientEncryption(array $options)   X-Ref
Returns a ClientEncryption instance for explicit encryption and decryption

param: array $options Encryption options
return: ClientEncryption

dropDatabase($databaseName, array $options = [])   X-Ref
Drop a database.

param: string $databaseName Database name
param: array  $options      Additional options
return: array|object Command result document

getManager()   X-Ref
Return the Manager.

return: Manager

getReadConcern()   X-Ref
Return the read concern for this client.

return: ReadConcern

getReadPreference()   X-Ref
Return the read preference for this client.

return: ReadPreference

getTypeMap()   X-Ref
Return the type map for this client.

return: array

getWriteConcern()   X-Ref
Return the write concern for this client.

return: WriteConcern

listDatabaseNames(array $options = [])   X-Ref
List database names.


listDatabases(array $options = [])   X-Ref
List databases.

param: array $options
return: DatabaseInfoIterator

selectCollection($databaseName, $collectionName, array $options = [])   X-Ref
Select a collection.

param: string $databaseName   Name of the database containing the collection
param: string $collectionName Name of the collection to select
param: array  $options        Collection constructor options
return: Collection

selectDatabase($databaseName, array $options = [])   X-Ref
Select a database.

param: string $databaseName Name of the database to select
param: array  $options      Database constructor options
return: Database

startSession(array $options = [])   X-Ref
Start a new client session.

param: array $options Session options
return: Session

watch(array $pipeline = [], array $options = [])   X-Ref
Create a change stream for watching changes to the cluster.

param: array $pipeline List of pipeline operations
param: array $options  Command options
return: ChangeStream

getVersion()   X-Ref
No description

mergeDriverInfo(array $driver)   X-Ref
No description