Reloading instances

If you need to get your instance in sync, you can use the methodreload. It will fetch the current data from the database and overwrite the attributes of the model on which the method has been called on.

  1. Person.findOne({ where: { name: 'john' } }).then(person => {
  2. person.name = 'jane'
  3. console.log(person.name) // 'jane'
  4. person.reload().then(() => {
  5. console.log(person.name) // 'john'
  6. })
  7. })