public function getHosts()
{
$this->connect();
// Ensure pings are up-to-date
foreach ($this->hosts as $host) {
$this->pingHost($host['host'], $host['port']);
}
return $this->hosts;
}
/** * Checks whether the connection is initialized and connected. * * @return boolean */ public function isConnected() { if (!($this->mongoClient instanceof \MongoClient || $this->mongoClient instanceof \Mongo)) { return false; } return count($this->mongoClient->getHosts()) > 0; }