def get_col(cls, db_conn_uri=None): """ 链接数据库 """ db = Mongo.get_instance(db_conn_uri) if db_conn_uri else Mongo.get_db() return db[cls._col_name]
def _get_col(cls, db_conn_uri=None): """ 链接数据库 :param db_conn_uri: 链接配置 :return: 链接句柄 """ db = Mongo.get_instance(db_conn_uri) if db_conn_uri else Mongo.get_db() return db[cls.__col_name]
def __init__(self, url=None): self._db = Mongo.get_db(url)