PHP Class Mongolid\Connection\Connection

Show file Open project: leroy-merlin-br/mongolid Class Usage Examples

Public Properties

Property Type Description
$defaultDatabase string The default database where mongolid will store the documents.

Protected Properties

Property Type Description
$rawConnection MongoDB\Client The raw MongoDB\Client object that represents this connection.
$rawManager MongoDB\Client The raw MongoDB\Manager object to perform bulk operations.

Public Methods

Method Description
__construct ( string $server = 'mongodb://localhost:27017', array $options = ['connect' => true], array $driver_options = [] ) Constructs a new Mongolid connection. It uses the same constructor parameters as the original MongoDB\Client constructor.
getRawConnection ( ) : MongoDB\Client Getter for Client instance.
getRawManager ( ) : MongoDB\Driver\Manager Getter for Manager instance.

Protected Methods

Method Description
findDefaultDatabase ( string $connectionString ) : void Find and stores the default database in the connection string.

Method Details

__construct() public method

Constructs a new Mongolid connection. It uses the same constructor parameters as the original MongoDB\Client constructor.
See also: http://php.net/manual/en/mongodb-driver-manager.construct.php
public __construct ( string $server = 'mongodb://localhost:27017', array $options = ['connect' => true], array $driver_options = [] )
$server string The specified connection string.
$options array The mongodb client options.
$driver_options array The mongodb driver options when opening a connection.

findDefaultDatabase() protected method

Find and stores the default database in the connection string.
protected findDefaultDatabase ( string $connectionString ) : void
$connectionString string MongoDB connection string.
return void

getRawConnection() public method

Getter for Client instance.
public getRawConnection ( ) : MongoDB\Client
return MongoDB\Client

getRawManager() public method

Getter for Manager instance.
public getRawManager ( ) : MongoDB\Driver\Manager
return MongoDB\Driver\Manager

Property Details

$defaultDatabase public property

The default database where mongolid will store the documents.
public string $defaultDatabase
return string

$rawConnection protected property

The raw MongoDB\Client object that represents this connection.
protected Client,MongoDB $rawConnection
return MongoDB\Client

$rawManager protected property

The raw MongoDB\Manager object to perform bulk operations.
protected Client,MongoDB $rawManager
return MongoDB\Client