Passe um retorno de chamada para
report.save
e chame res.redirect
de lá:router.post('/get/:faultId/new_comment', function(req, res, next) {
var commenter = req.body.first_name + " " + req.body.last_name;
var comment = req.body.new_comment_text
var datetime = Date.now();
var comment_object = commentCreate(commenter, comment, datetime);
FaultReport
.findOne({
'_id': req.params.faultId
})
.exec(function(err, report) {
if (err) return console.error(err);
report.comment.push(comment_object);
report.save(function(err) {
res.redirect('/api/get/' + req.params.faultId);
});
});
});