Created
November 2, 2011 21:01
-
-
Save alessioalex/1334904 to your computer and use it in GitHub Desktop.
Emit event with Mongoose
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
UserSchema.post('save', function() { | |
this.emit('changed', this, this.altered); | |
delete this.altered; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment