Skip to content

Commit eaf2b8f

Browse files
committed
Add credentials to options array in config
1 parent f3c646e commit eaf2b8f

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ And add a new mongodb connection:
117117
'host' => env('DB_HOST', 'localhost'),
118118
'port' => env('DB_PORT', 27017),
119119
'database' => env('DB_DATABASE', ''),
120-
'username' => env('DB_USERNAME', ''),
121-
'password' => env('DB_PASSWORD', ''),
122120
'options' => [
123-
'db' => 'admin' // sets the authentication database required by mongo 3
121+
'db' => 'admin', // sets the authentication database required by mongo 3
122+
'username' => env('DB_USERNAME', ''),
123+
'password' => env('DB_PASSWORD', ''),
124124
]
125125
],
126126
```

src/Jenssegers/Mongodb/Connection.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ protected function createConnection($dsn, array $config, array $options)
135135
if (isset($config['driver_options']) && is_array($config['driver_options'])) {
136136
$driverOptions = $config['driver_options'];
137137
}
138-
139-
// Get the credentials from the config and check if they are set
140-
$options['username'] = isset($options['username']) ? $config['username'] : '';
141-
$options['password'] = isset($options['password']) ? $config['password'] : '';
142138

143139
return new Client($dsn, $options, $driverOptions);
144140
}

0 commit comments

Comments
 (0)