am new to node.js
what i want is to call shedule.schedulejobs
inside another function.
the following code is for updating some data in to db.i want to call the schedulejob after updatingthe details to database.how it is possible.
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) {
});
});
}
schedule job function
var j = schedule.scheduleJob(date, function(id){
return function(){
console.log("inside----------")
console.log(id)
};
}(id));