为什么在mongoose的预存储钩子和保存后钩子的“this”关键字不同?

这是我的代码的相关片段

MySchema .pre('save', function (next) { var self = this; console.log(self); return next(); }); MySchema .post('save', function (next) { var self = this; console.log(self); }); 

出于某种原因,在这种情况下,预保存钩子给出了一个适当的对象

 { farm: 557ce790a893e4e0118059e3, _id: 557ce791a893e4e011805a35, privileges: [ { instanceId: 557ce790a893e4e0118059bb, access: 5, modelType: 'User' } ], public: 0, properties: { crop: 'No Crop', name: 'Pirani Tract 50' }, geometry: { type: 'Polygon', coordinates: [ [Object] ] } } 

但后保存钩简单地logging

 { domain: null, _events: { save: [ [Function: notify], [Function] ], isNew: [Function: notify], init: [Function] }, _maxListeners: 0 } 

post中间件接收文件作为参数而不是pre中间件接收的nextstream控callback参数。

 MySchema .post('save', function(doc) { console.log(doc); });