populate author of comments
This commit is contained in:
parent
f95a26acbb
commit
d824844ae5
@ -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')))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user