with this code i’m trying to get more details for product table in the data base but i get the error below
router.get(`/:id`, async (req, res) => {
const order = await Order.findById(req.params.id)
.populate('user', 'name')
.populate({path:'orderItems' , populate: {path: "product", model:"Product"}})
if (!order) {
res.status(500).json({
error: err,
seccess: false,
});
} else {
res.send(order);
}
});
i get this error
MissingSchemaError: Schema hasn't been registered for model "Product".
i don’t understand why
1