Created
September 9, 2011 16:31
-
-
Save danmactough/1206674 to your computer and use it in GitHub Desktop.
Workaround for https://github.com/LearnBoost/mongoose/issues/423
This file contains 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
Model.post('init', function() { | |
if (!this.isNew) { | |
var my = this | |
, activePaths = Object.keys(this._activePaths.states.init); | |
Object.keys(my._doc).forEach(function(path){ | |
if (activePaths.indexOf(path) === -1) { | |
delete(my._doc[path]); | |
} | |
}); | |
this._doc = my._doc; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment