更新模型后,我想在活动集合中插入新文档
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是活动架构