【发布时间】:2019-07-28 12:57:32
【问题描述】:
所以如果我执行以下操作:
Chat.findOne({ user: req.user._id })
.populate({ path: 'chat_list.participants' })
.then((chat) => {
res.json(chat);
})
输出如下:
{
"_id": "5c7ff03f8ae0be31a0b7002f",
"chat_list": [
{
"participants": [
{
"securityQuestions": {
"isSetup": false
},
"videos": [],
"events": [],
"_id": "5c7d66065619c542e81583c6",
"name": "Tobi Uchiha",
"email": "tobi@gmail.com",
"date": "2019-03-04T17:53:10.267Z",
"__v": 0,
"profile": "5c7d66065619c542e81583ca",
"profile_type": "PartnerAdminProfile"
}
],
"messages": [],
"_id": "5c800d7997f7d74bacade2a6"
}
],
"user": "5c7f36d7e7a5c04e5046e8ca",
"chat_history": [],
"__v": 0
}
我也在尝试填充配置文件。但如果我做这样的事情 .populate({ path: 'chat_list.participants.profile' }) 它只是退出。如何在填充的参与者数组中填充嵌套配置文件?
【问题讨论】:
标签: mongoose