Establish a connection with the database.

        Returns MongoDb collection

def get_collection(self, **kwargs):
        """
        Establish a connection with the database.

        Returns MongoDb collection
        """
        from pymongo import MongoClient

        if self.host and self.port:
            client = MongoClient(host=config.host, port=config.port)
        else:
            client = MongoClient()
        db = client[self.dbname]

        # Authenticate if needed
        if self.user and self.password:
            db.autenticate(self.user, password=self.password)

        return db[self.collection]