/** * Check if the value of attribute is changed or not. * @param {string} name - attribute name * @example * const post = await Post.findOne({ title: 'Leah' }) * post.title = 'Deckard Cain' * post.attributeChanged('title') // => true * post.title = 'Leah' * post.attributeChanged('title') // => false */ attributeChanged(name) { if (this.rawUnset.has(name)) return false; const value = this.attribute(name); const valueWas = this.attributeWas(name); return !util.isDeepStrictEqual(value, valueWas); }