From d824844ae5c00c23e8a472e91fcec2936767b066 Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Alexandrovich Date: Sun, 19 Jan 2025 21:05:08 +0300 Subject: [PATCH] populate author of comments --- server/routers/todo/comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routers/todo/comment.js b/server/routers/todo/comment.js index c4ebbf0..a6e5b4e 100644 --- a/server/routers/todo/comment.js +++ b/server/routers/todo/comment.js @@ -42,7 +42,7 @@ router.get('/:todoId/:itemId', async (req, res) => { return res.send(getAnswer(new Error('no such todo'))) } - const item = await ItemModel.findById(itemId).populate('comments').exec() + const item = await ItemModel.findById(itemId).populate({ path: 'comments', populate: { path: 'author' } }).exec() if (!item) { return res.send(getAnswer(new Error('no such item'))) }