0.2.0 • Published 8 years ago
mongoose-diff v0.2.0
Mongoose "Diff" Plugin
This is a simple plugin to expose changes during the pre-save hooks.
Installation
$ npm install mongoose-diff --save
Usage
var diff = require('mongoose-diff');
schema.plugin(diff, {}); // This needs to run BEFORE pre-save hooks
schema.pre('save', function(next) {
if (this._diff) {
// Do something with this._diff
}
});
Change Log
0.2.0
- Merged lchenay's pull request #1:
- Use a
virtual
instead of an object property - Don't apply transformations during toObject() calls
- Use a
- Updated dependencies
- Added additional testing
- Refactored code slightly
- Exposed a
virtualName
option to change the virtual name from_diff
to whatever you want
0.1.0
- Initial release