Пример #1
0
 /**
  * Create a new database connection instance.
  *
  * @param  array   $config
  */
 public function __construct(array $config)
 {
     $this->config = $config;
     // Build the connection string
     $dsn = $this->getDsn($config);
     // You can pass options directly to the MongoClient constructor
     $options = array_get($config, 'options', []);
     // Create the connection
     $this->connection = $this->createConnection($dsn, $config, $options);
     // Select database
     $this->db = $this->connection->selectDatabase($config['database']);
     $this->useDefaultPostProcessor();
 }