async update(req, res) { if(!req.params.id || !req.body.name) { res.status(400); res.json({ success: false, message: 'Bad request' }); } const _id = req.params.id; await Employee.updateOne({ _id }, req.body); const updatedEmployee = await Employee.findById(_id); res.status(200); res.json({ success: true, body: updatedEmployee, message: 'Ok' }); }