getMongoClient() public method

Get mongo connection instance
public getMongoClient ( ) : MongoClient
return MongoClient
Exemplo n.º 1
0
 public function __construct(Client $client, $database)
 {
     $this->client = $client;
     if ($database instanceof \MongoDB) {
         $this->mongoDB = $database;
     } else {
         $this->mongoDB = $this->client->getMongoClient()->selectDB($database);
     }
 }
Exemplo n.º 2
0
 /**
  *
  * @return \MongoDB
  */
 public function getMongoDB()
 {
     if (empty($this->database)) {
         $this->database = $this->client->getMongoClient()->selectDB($this->databaseName);
     }
     return $this->database;
 }