1
我想在從客戶端調用它時從服務器接收的成功回調中寫入數據庫。流星:從服務器方法成功回調時寫入數據庫
Meteor.call('job', 'new', name, script, function(err,response) {
if(err) {
console.log(err);
alert('Error while processing your script. Please make sure syntax is correct.')
return;
}else{
taskid = response;
console.log(taskid);
FileSystem.update({ _id: this.params.fileId }, { $set: { content: content, taskid:taskid} }, function (e, t) {
if (e) {
//error
}
});
}
});
寫現在它說
Exception in delivering result of invoking 'job': TypeError: Cannot read property 'fileId' of undefined
我預計其將只更新數據庫,當服務器調用成功。我怎樣才能做到這一點?
這是一個路由? 'this.params'從哪裏來? – challett