Skip to content

Commit a4c2c7b

Browse files
committed
Tweaking DSN for issue #21
1 parent 51bb07a commit a4c2c7b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ Or you can access the internal object directly:
258258

259259
Add one or more items to an array.
260260

261-
User::where('name', 'John')->push('items', 'boots');
262-
User::where('name', 'John')->push('items', array('sword', 'shield'));
261+
DB::collection('users')->where('name', 'John')->push('items', 'boots');
262+
DB::collection('users')->where('name', 'John')->push('items', array('sword', 'shield'));
263263

264264
**Pull**
265265

266266
Remove one or more values from an array.
267267

268-
User::where('name', 'John')->pull('items', 'boots');
269-
User::where('name', 'John')->pull('items', array('sword', 'shield'));
268+
DB::collection('users')->where('name', 'John')->pull('items', 'boots');
269+
DB::collection('users')->where('name', 'John')->pull('items', array('sword', 'shield'));
270270

271271
### Query Caching
272272

src/Jenssegers/Mongodb/Connection.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(array $config)
3737
$this->connection = new MongoClient($this->getDsn($config), $options);
3838

3939
// Select database
40-
$this->db = $this->connection->{$config['database']};
40+
$this->db = $this->connection->selectDB($config['database']);
4141
}
4242

4343
/**
@@ -130,7 +130,7 @@ protected function getDsn(array $config)
130130
$credentials = '';
131131
}
132132

133-
return "mongodb://{$credentials}" . implode(',', $hosts) . "/{$database}";
133+
return "mongodb://{$credentials}" . implode(',', $hosts);
134134
}
135135

136136
/**

0 commit comments

Comments
 (0)