MongoClient::close PHP Method

close() public method

Closes this connection
public close ( boolean | string $connection = null ) : boolean
$connection boolean | string - If connection is not given, or FALSE then connection that would be selected for writes would be closed. In a single-node configuration, that is then the whole connection, but if you are connected to a replica set, close() will only close the connection to the primary server.
return boolean - Returns if the connection was successfully closed.
    public function close($connection = null)
    {
        $this->purgeAllProtocols();
        //TODO: implement $connection handling
    }

Usage Example

Example #1
0
 public function disconnect()
 {
     if ($this->_connection) {
         $this->_connection->close();
     }
     $this->_db = $this->_connection = NULL;
 }
All Usage Examples Of MongoClient::close