skip to Main Content

Mongodb – When there are two objects inside an array in Mongoose, how can i populate them?

router.get('/mypage/myreport-comment', catchAsync( async(req, res) => { const { id } = req.user; const { page } = req.query; const totalPost = await Comment.find({'reports.user': id}).populate('reports.user'); //.countDocuments({}); let { startPage, endPage, hidePost, maxPost, totalPage, currentPage } = myPageCommentPaging(page, totalPost); const comments =…

VIEW QUESTION
Back To Top
Search