Add credentials to options array in config

parent f3c646e9
...@@ -117,10 +117,10 @@ And add a new mongodb connection: ...@@ -117,10 +117,10 @@ And add a new mongodb connection:
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 27017), 'port' => env('DB_PORT', 27017),
'database' => env('DB_DATABASE', ''), 'database' => env('DB_DATABASE', ''),
'options' => [
'db' => 'admin', // sets the authentication database required by mongo 3
'username' => env('DB_USERNAME', ''), 'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'options' => [
'db' => 'admin' // sets the authentication database required by mongo 3
] ]
], ],
``` ```
......
...@@ -136,10 +136,6 @@ class Connection extends \Illuminate\Database\Connection ...@@ -136,10 +136,6 @@ class Connection extends \Illuminate\Database\Connection
$driverOptions = $config['driver_options']; $driverOptions = $config['driver_options'];
} }
// Get the credentials from the config and check if they are set
$options['username'] = isset($options['username']) ? $config['username'] : '';
$options['password'] = isset($options['password']) ? $config['password'] : '';
return new Client($dsn, $options, $driverOptions); return new Client($dsn, $options, $driverOptions);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment