If I am updating all parameters it's working fine but if I am updating separately any parameter then other parameters getting null. I don't know how to handle this condition.
I want that if I am updating one parameter it should not affect other properties.
router.put('/session/addActivity/:sessionID',function(req,res){
Session.findOne({_id:req.params.sessionID},function(err,session){
if(err){
return res.send(err);
}
if(session){
session.qanda.isEnable = req.body.qanda_enabled;
session.qanda.isModerate = req.body.qanda_moderation;
session.qanda.isCommentEnable = req.body.qanda_comments;
session.qanda.isAnonymousResponse = req.body.qanda_anonymousResponse;
session.poll.isEnable = req.body.poll_enabled;
session.poll.isMultiSelect = req.body.poll_MultiSelect;
session.poll.answerLimit = req.body.poll_answerLimit;
session.pulse.isEnable = req.body.pulse_enabled;
session.pulse.isAnonymousResponse = req.body.pulse_anonymousResponse;
session.pulse.votesLimitPerUser = req.body.pulse_votesPerUser;
session.save(function(err,session){
if(err){
return res.send(err);
}
else{
res.json(session);
}
});
}
})
});
via Ikshit Mathur
No comments:
Post a Comment