问题描述
我正在使用mongoDB来存储项目中的错误日志,但是问题是,有时无法连接或复制mongoDB值,然后抛出错误会使python进程崩溃。
client = MongoClient()
mongodb = client[db]
class CollectionNames:
Invoke = 'invoke'
md = 'error'
mongodb[CollectionNames.invoke].insert_one(md)
我无法为所有pymongo内置函数insert_one
或insert_all
一次一试地尝试摘录
try:
mongodb[CollectionNames.Invoke].insert_one(md)
except:
nothing()
如何在pymongo内置函数之前包装insert_one
。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)