在mongoose中填充嵌套數(shù)組如何在示例文檔中填充“組件”: {
"__v": 1,
"_id": "5252875356f64d6d28000001",
"pages": [
{
"__v": 1,
"_id": "5252875a56f64d6d28000002",
"page": {
"components": [
"525287a01877a68528000001"
]
}
}
],
"author": "Book Author",
"title": "Book Title"
}這是我的JS,我通過(guò)Mongoose獲取文檔: Project.findById(id).populate('pages').exec(function(err, project) {
res.json(project);
});
在mongoose中填充嵌套數(shù)組
月關(guān)寶盒
2019-08-26 14:32:26