node.jsは初めてです
私が望むのは、shedule.schedulejobs
別の関数内で呼び出すことです。次のコードは、一部のデータを db に更新するためのものです。詳細をデータベースに更新した後、スケジュール ジョブを呼び出したいと考えています。
exports.saveJobs = function (jobsCollection, context) {
console.log(utils.httpBody(context.req));
var record = utils.httpBody(context.req);
var id =record.id;
var date =record.date;
jobsCollection.update({ id: record.id}, { $set: record}, { upsert: true }, function (err, result) {
if (!err) return context.sendJson([], 404);
// i need to call the schedule jobs after performing updation to db
schedule.scheduleJob(date, function (id) {
});
});
}
スケジュールジョブ機能
var j = schedule.scheduleJob(date, function(id){
return function(){
console.log("inside----------")
console.log(id)
};
}(id));