Back

reload()

Refreshes the property values of a model object from the database. This is useful when an object’s values might have changed in the database due to other operations or external processes. By calling reload(), you ensure that your object reflects the current state of the corresponding database record.

Name Type Required Default Description
1. Get an object, call a method on it that could potentially change values, and then reload the values from the database
employee = model("employee").findByKey(params.key);
employee.someCallThatChangesValuesInTheDatabase();
employee.reload();
Copied!