0.2.0 • Published 8 years ago

mongoose-diff v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Mongoose "Diff" Plugin

Build Status

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
  • 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