Adding the database to the DSN we are sending to the MongoDB server

This commit is contained in:
Wotre 2012-06-23 15:26:02 +02:00
parent 0d4b02e452
commit 81d0552ba4

View File

@ -114,7 +114,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
{
if ($this->mongo === null) {
if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) {
$mongo = new \Mongo($matches[1]);
$mongo = new \Mongo($matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : ''));
$database = $matches[2];
$collection = $matches[3];
$this->mongo = $mongo->selectCollection($database, $collection);