Skip to content

Commit

Permalink
MongoDriver small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Cassani committed Aug 30, 2017
1 parent dcdfba7 commit 819f11f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Infrastructure/Drivers/MongoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ public function check()
public function connect()
{
$connectionString = 'mongodb://';
$connectionString .= ($this->config['username'] && $this->config['password']) ? $this->config['username'].':'.$this->config['password'].'@' : '';
$connectionString .= (isset($this->config['username']) && isset($this->config['password'])) ? $this->config['username'].':'.$this->config['password'].'@' : '';
$connectionString .= $this->config['host'].':'.$this->config['port'];

$this->instance = (new Client($connectionString))->selectDatabase($this->config['database']);
$database = (isset($this->config['database'])) ? $this->config['database'] : 'eventstore';

$this->instance = (new Client($connectionString))->selectDatabase($database);

return true;
}
Expand Down

0 comments on commit 819f11f

Please sign in to comment.