我在节点项目中使用 now.js 和 Mongoose,并且无法访问 mongoose 函数内的 this.now 对象。例如
everyone.now.joinDoc = function (project_id){
this.now.talk(); //this will work
Project.findOne({'_id':project_id}, function(err, project){
if(project){
this.now.talk(); // this will not work "TypeError: Cannot call method 'bark' of undefined"
};
});
};