What
Is a mongoose plugin that automatically keeps track of when the document has been created, updated and optionally when some fields have been modified
Install
npm install mongoose-trackable
Usage
// see examples/track_model.js var OrderSchema = products: Array var Order = mongoose Order
Order is a trackable model, by default a trackable model will track the creation time in the createdAt
field and last update time in the updatedAt
field
Moreover you can keep track of all the changes of a certain field using the option fieldsToTrack
// see examples/track_field.js var OrderSchema = products: Array status: String var Order = mongoose Order
For more options and more use cases see spec/acceptance.js
TODO
- more and better documentation
skiptToTrackDocumentUpdates
vsskipToTrackFieldsUpdates