getConnection() public method

Gets a connection from the pool. It will cycle through the existent connections.
public getConnection ( ) : Connection
return Connection
 /**
  * Retrieves the Collection object.
  *
  * @return Collection
  */
 protected function getCollection() : Collection
 {
     $conn = $this->connPool->getConnection();
     $database = $conn->defaultDatabase;
     $collection = $this->schema->collection;
     return $conn->getRawConnection()->{$database}->{$collection};
 }
Beispiel #2
0
 /**
  * Get the raw MongoDB connection.
  *
  * @return \MongoDB\Client
  */
 public function getConnection()
 {
     $this->init();
     return $this->connectionPool->getConnection()->getRawConnection();
 }