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.
Person.findOne({ where: { name: 'john' } }).then(person => {
person.name = 'jane'
console.log(person.name) // 'jane'
person.reload().then(() => {
console.log(person.name) // 'john'
})
})