I have a statement like: jsonify_ok(data=mytag.reload().as_dict())
What role does reload() play? what's the normal situation for us to use reload()?
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.
This could be useful if the data could or has changed before calling jsonify_ok
.
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
"
Relevant documentation link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With