pymongo连接与使用
class DatabaseSClass(object):def __init__(self, db_name):self.mongo_client = pymongo.MongoClient('mongodb://user_name:password@127.0.0.1:27017/')self.db_name = db_nameself.db_cursor = self.mongo_clien
·
class DatabaseSClass(object):
def __init__(self, db_name):
self.mongo_client = pymongo.MongoClient('mongodb://user_name:password@127.0.0.1:27017/')
self.db_name = db_name
self.db_cursor = self.mongo_client[self.db_name]
self.ai_anchor_host_col = self.db_cursor['ai_anchor_host']
def find_all_data(self, col_str):
print(f"col_str = {col_str}")
cursor = col_str.find({}, {'_id': 0})
return list(cursor)
def insert_many(self, col_str, data_list):
res = col_str.insert_many(data_list)
return res
更多推荐
已为社区贡献1条内容
所有评论(0)