MongoEngine 中的 "reload()" 是什么

What is "reload()" for in MongoEngine

我有这样的声明:jsonify_ok(data=mytag.reload().as_dict())

reload()有什么作用?我们使用reload()的正常情况是什么?

Document.reload() 将检查数据库并使用已修改的任何属性更新您的数据(我认为在这种情况下 mytag 但我看不到这是什么)。

如果数据在调用 jsonify_ok.

之前可能或已经更改,这可能会有用

分解你的 data=mytag.reload() 这表示:"For document mytag, go to the database and fetch the latest version of this document, assigning this to variable data"

Relevant documentation link