diff --git a/api/routes/orders.js b/api/routes/orders.js index aadce9b..9d39184 100644 --- a/api/routes/orders.js +++ b/api/routes/orders.js @@ -9,6 +9,7 @@ const Product = require("../models/product"); router.get("/", (req, res, next) => { Order.find() .select("product quantity _id") + .populate('product', 'name') .exec() .then(docs => { res.status(200).json({ @@ -73,6 +74,7 @@ router.post("/", (req, res, next) => { router.get("/:orderId", (req, res, next) => { Order.findById(req.params.orderId) + .populate('product') .exec() .then(order => { if (!order) {