Task.findOneAndUpdate({"_id": req.body.id_project},
{$push: {'context_task': {'task': req.body.input_task,'status': false}}},{new: true},
function (err, doc) {
if (err) return next(err);
console.log(doc.context_task[doc.context_task.length-1]._id);//получаем ID новой записи
res.status(200).send();
});