Model Object
reload()
Signature
Section titled “Signature”reload() — returns void
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Reloads the property values of this object from the database.
Examples
Section titled “Examples”// 1. Reload after a call that may have changed values in the database
employee = model("Employee").findByKey(params.key);
employee.someCallThatChangesValuesInTheDatabase();
employee.reload();
// 2. Discard in-memory changes and restore the current database values
post = model("Post").findByKey(params.id);
post.title = "Draft title that we want to discard";
post.reload();
// post.title now reflects the value stored in the database