louischatriot/nedb — pull request #156 by duncanbrown (2014-03-16 21:44:30+00:00)
Title: Inserted, updated and removed events

I think it would be useful for the datastore to expose data change events. This is an implementation with events that get emitted whenever documents are inserted, updated or removed:

````
db.on('inserted', function(docs){
//docs is an array of documents that have just been inserted
});
db.on('updated', function(docs){
//docs is an array of documents that have just been updated
});
db.on('removed', function(docs){
//docs is an array of documents that have just been removed
});
````
For consistency `docs` is always an array, even when only a single document has been inserted/updated/removed.