Skip to content

Commit 00d3b8b

Browse files
committed
Merge pull request mongodb#564 from nerijunior/master
DB Connection example updated to use env
2 parents 4249c5e + dffd348 commit 00d3b8b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ And add a new mongodb connection:
7979
```php
8080
'mongodb' => array(
8181
'driver' => 'mongodb',
82-
'host' => 'localhost',
83-
'port' => 27017,
84-
'username' => 'username',
85-
'password' => 'password',
86-
'database' => 'database',
82+
'host' => env('DB_HOST', 'localhost'),
83+
'port' => env('DB_PORT', 27017),
84+
'database' => env('DB_DATABASE', ''),
85+
'username' => env('DB_USERNAME', ''),
86+
'password' => env('DB_PASSWORD', ''),
8787
'options' => array(
8888
'db' => 'admin' // sets the authentication database required by mongo 3
8989
)
@@ -96,10 +96,10 @@ You can connect to multiple servers or replica sets with the following configura
9696
'mongodb' => array(
9797
'driver' => 'mongodb',
9898
'host' => array('server1', 'server2'),
99-
'port' => 27017,
100-
'username' => 'username',
101-
'password' => 'password',
102-
'database' => 'database',
99+
'port' => env('DB_PORT', 27017),
100+
'database' => env('DB_DATABASE', ''),
101+
'username' => env('DB_USERNAME', ''),
102+
'password' => env('DB_PASSWORD', ''),
103103
'options' => array('replicaSet' => 'replicaSetName')
104104
),
105105
```

0 commit comments

Comments
 (0)