I have a problem when working with nodejs and mongo that I cannot solve, and that is that I try to access a subdocument of my collections through id, but I only get the id of the subdocument, therefore when trying to access that data I get null , this is the code in the controller (this controller is from a boolean of this subdocument, which I need to change the state) but I can't access the data in the subdocument. I read that I need the id of the parent document to be able to access the subdocument, but when using the req.params.id it gives me the id of the subdocument
export const orderDone = async (req, res, next) => {
let { id } = req.params;
console.log(id)
//6330f927a315fbfcb6a5765b
const task = await Client.findById(id)
console.log(task)
//null
res.redirect("/buscar");
};