【发布时间】:2020-07-16 05:44:05
【问题描述】:
在我的父母内部,我有很多孩子,其中一个孩子也有很多子孩子,我需要返回特定孩子的子孩子。
exports.test = (req, res) => {
Forum.find({title: req.params.id}).then(record => {
console.log(record);
})
};
当我插入正确的新闻和公告 url 参数时,这里的代码返回以下内容:
_id: 5e7bf52ebb5b2b09fb46e29f,
title: 'News & Announcements',
property: 'ACP',
position: 1,
visible: true,
topics: [ [Object], [Object], [Object] ],
__v: 5 } ]
然后我想访问主题并返回一个特定主题 - 如上所述通过名称/标题找到它,我该怎么做?
【问题讨论】:
标签: node.js mongodb mongoose find subdocument