问题描述
我有一条类似jsonify_ok(data=mytag.reload().as_dict())
reload()扮演什么角色?我们使用reload()的正常情况是什么?
What role does reload() play? what's the normal situation for us to use reload()?
推荐答案
Document.reload()
将检查数据库并使用任何属性更新您的数据(在这种情况下,我认为mytag
,但我看不到这是什么)已被修改.
Document.reload()
will check the database and update your data (I think in this case mytag
but I can't see what this is) with any attributes that have been modified.
如果在调用jsonify_ok
之前数据可能已经或已更改,这可能会很有用.
This could be useful if the data could or has changed before calling jsonify_ok
.
破坏data=mytag.reload()
的内容是:对于文档mytag
,转到数据库并获取此文档的最新版本,并将其分配给变量data
"
Breaking down your data=mytag.reload()
this says: "For document mytag
, go to the database and fetch the latest version of this document, assigning this to variable data
"
这篇关于什么是"reload()"?在MongoEngine中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!