After update model I want to insert new document in activity collection
MySchema.post('update', function(doc, next) {
// here i want to access req.user (current logged In user)
ActivityLog.create({
collectionType: 'MySchema'
action: 'updated',
loggedBy: req.user
}).then(function(activity) {
return next();
});
});
ActivityLog is Activity schema