public function getMongoClient() { if ($this->mongoClient) { return $this->mongoClient; } $this->mongoClient = new \MongoClient($this->dsn, $this->connectOptions); return $this->mongoClient; }
public function __construct(Client $client, $database) { $this->client = $client; if ($database instanceof \MongoDB) { $this->mongoDB = $database; } else { $this->mongoDB = $this->client->getMongoClient()->selectDB($database); } }