Python MongoEngine-如何确保文档已保存?

Python MongoEngine-如何确保文档已保存?,python,mongoengine,Python,Mongoengine,定义文档、创建实例并对该实例调用save方法后,确保文档保存成功的最佳方法是什么 我应该实现post_save方法,使用try/except block,还是有更好的方法?save()是一个同步调用: Save the :class:`~mongoengine.Document` to the database. If the document already exists, it will be updated, otherwise it will be created. Returns th

定义文档、创建实例并对该实例调用save方法后,确保文档保存成功的最佳方法是什么

我应该实现post_save方法,使用try/except block,还是有更好的方法?

save()
是一个同步调用:

Save the :class:`~mongoengine.Document` to the database. If the
document already exists, it will be updated, otherwise it will be
created. Returns the saved object instance.
使用
try/except
块处理错误