this is my code code and i am trying to update things in raw materials
exports.updateRawmateial = (req, res) => {
const rawmaterial = req.rawmaterial;
rawmaterial.name = req.body.name;
rawmaterial.save((err, updatedRawmaterial) => {
if (err) {
return res.status(400).json({
error: "Unable to Upadte the RawMaterial"
});
}
res.json(updatedRawmaterial);
});
};
and this is the error I am getting
Cannot set property 'name' of undefined
at exports.updateRawmateial (C:UserslmtlaOneDriveDesktoppraveenbhaiackendcontrollers
awmaterial.js:45:22)
at Layer.handle [as handle_request] (C:UserslmtlaOneDriveDesktoppraveenbhaiackend
ode_modulesexpresslib
outerlayer.js:95:5)
question from:
https://stackoverflow.com/questions/66060453/can-you-identify-where-i-am-going-wrong 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…