public function connect()
    {
        if ($this->_mongo) {
            return $this->_mongo;
        }

        if ($this->logger() && $this->logQueries()) {
            $logger = $this->buildStreamContext();
        } else {
            $logger = [];
        }

        $this->_mongo = Monga::connection($this->dns(), $this->getMongoConfig(), $logger);
        $this->_connected = true;
        return $this->_mongo;
    }
public function connect()
    {
        if ($this->_mongo) {
            return $this->_mongo;
        }

        if ($this->logger() && $this->logQueries()) {
            $logger = $this->buildStreamContext();
        } else {
            $logger = [];
        }

        $this->_mongo = Monga::connection($this->dns(), $this->getMongoConfig(), $logger);
        $this->_connected = true;
        return $this->_mongo;
    }
public function connect ( ) { if ( $ this -> _mongo ) { return $ this -> _mongo ; } if ( $ this -> logger ( ) && $ this -> logQueries ( ) ) { $ logger = $ this -> buildStreamContext ( ) ; } else { $ logger = [ ] ; } $ this -> _mongo = Monga :: connection ( $ this -> dns ( ) , $ this -> getMongoConfig ( ) , $ logger ) ; $ this -> _connected = true ; return $ this -> _mongo ; }
Connects to our MongoDB instance and returns the connection object.  If we have connected previously, returns the
old connection object that's already been established.

@return Monga\Connection|null
Connects to our MongoDB instance and returns the connection object . If we have connected previously returns the old connection object that s already been established .