def __getattr__(self, name):
        """Map a database name to the coresponding pymongo.Database instance"""
        connection = self._get_connection_by_db_name(name)
        database = self._init_database(connection, name)
        # Remember this name->database mapping on the object. This will cause
        # future references to the same name to NOT invoke self.__getattr__,
        # and be resolved directly at object level.
        setattr(self, name, database)
        self._mapped_databases.append(name)
        return database
def __getattr__ ( self , name ) : connection = self . _get_connection_by_db_name ( name ) database = self . _init_database ( connection , name ) setattr ( self , name , database ) self . _mapped_databases . append ( name ) return database
Map a database name to the coresponding pymongo.Database instance