What is the most convenient way to create/update object on saving changes to other? Imagine we have a model Client and we emit event on save.
clientSchema.post('save', function (client) {
process.emit('clientUpdate', client);
});
Then we can subscribe for that event like:
process.on('clientUpdate', function(client) {
//LOGIC GOES HERE
});
Let's assume we want now to update ClientProjection. Where you would locate the listener and how you would implement update logic for mongoDB(mongoose)- using model, by dao, etc.?
via kadiii
No comments:
Post a Comment