Adding the database to the DSN we are sending to the MongoDB server
This commit is contained in:
parent
0d4b02e452
commit
81d0552ba4
@ -114,7 +114,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
|
|||||||
{
|
{
|
||||||
if ($this->mongo === null) {
|
if ($this->mongo === null) {
|
||||||
if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) {
|
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];
|
$database = $matches[2];
|
||||||
$collection = $matches[3];
|
$collection = $matches[3];
|
||||||
$this->mongo = $mongo->selectCollection($database, $collection);
|
$this->mongo = $mongo->selectCollection($database, $collection);
|
||||||
|
Reference in New Issue
Block a user