lithium\data\source\MongoDb::disconnect PHP Method

disconnect() public method

Don't call the Mongo->close() method. The driver documentation states this should not be necessary since it auto disconnects when out of scope. With version 1.2.7, when using replica sets, close() can cause a segmentation fault.
public disconnect ( ) : boolean
return boolean True
    public function disconnect()
    {
        if ($this->server && $this->server->getConnections()) {
            $this->_isConnected = false;
            unset($this->connection, $this->server);
        }
        return true;
    }

Usage Example

Ejemplo n.º 1
0
 public function testBadConnection()
 {
     $db = new MongoDb(array('host' => null, 'autoConnect' => false));
     $this->expectException('Could not connect to the database.');
     $this->assertFalse($db->connect());
     $this->assertTrue($db->disconnect());
 }
All Usage Examples Of lithium\data\source\MongoDb::disconnect