public useDatabase ( string $name ) : |
||
$name | string | |
return |
public function useDatabase($name)
{
$this->currentDatabaseName = $name;
return $this;
}
/** * Get mongo client instance. * @return array $config */ public static function getClient() { // get configurations from config file here. $config = file_get_contents(__DIR__ . '/../config.json'); $config = (array) json_decode($config); $client = new Client($config['dns'] . '/' . $config['database']); $client->useDatabase($config['database']); return $client; }