mongoose-eventify
Mongoose plugin adding add, remove, and change events for attributes on Model class.
Install
Add the plugin as a dependency to your project in package.json
:
... "dependencies": "mongoose": ">=3.0.x" "mongoose-eventify": ">=0.0.1" ... ...
Run npm install
.
Example
// define our move schema and export our modelvar MoveSchema = date: type: Date;MoveSchema;var Move = mongoose;moduleexports = exports = Move; // now, in a different file, or wherever, we define some change events on the ModelMove; Move; Move; Move;
Credit
Inspired by mongoose-lifecycle Event syntax inspired by Backbone.js
License
MIT License