Created
July 30, 2020 10:27
-
-
Save Sarav-S/9efd05d117d1111672efc8ad4b76e0ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Marks the path as having pending changes to write to the db. | |
* | |
* _Very helpful when using [Mixed](./schematypes.html#mixed) types._ | |
* | |
* ####Example: | |
* | |
* doc.mixed.type = 'changed'; | |
* doc.markModified('mixed.type'); | |
* doc.save() // changes to mixed.type are now persisted | |
* | |
* @param {String} path the path to mark modified | |
* @param {Document} [scope] the scope to run validators with | |
* @api public | |
*/ | |
Document.prototype.markModified = function(path, scope) { | |
this.$__.activePaths.modify(path); | |
if (scope != null && !this.ownerDocument) { | |
this.$__.pathsToScopes[path] = scope; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment