【发布时间】:2017-12-28 05:56:09
【问题描述】:
我在 Mongodb 中有两个带有 nodejs 的表
每日体重
sub_exercise_id 锻炼_id 体重 身高
111111111111 44444444444 120 74
111111111111 44444444444 122 74
222222222222 44444444444 110 75
111111111111 55555555555 121 75
222222222222 55555555555 122 75
222222222222 55555555555 124 76
子练习
sub_exercise_id 名称
111111111111 胸部
222222222222 哑铃
我想要这种类型的回应
[ {
_id:“44444444444”
exerside_detail{
{
sub_exercise_id:"111111111111",
名称:“胸部”,
每日详细信息:[
{
重量:120,
身高:74
},
{
重量:122,
身高:74
}
]
},
{
sub_exercise_id:"222222222222",
名称:“胸部”,
每日详细信息:[
{
重量:110,
身高:75
}
]
}
}
},
{
_id:"55555555555"
exerside_detail:[
{
sub_exercise_id:"111111111111",
名称:“胸部”,
每日详细信息:[
{
重量:121,
身高:75
}
]
},
{
sub_exercise_id:"222222222222",
名称:“胸部”,
每日详细信息:[
{
重量:122,
身高:75
},
{
重量:124,
身高:76
}
]
}
]
}
]
【问题讨论】:
-
我们不为您工作。 stackoverflow.com/help/on-topic
标签: javascript node.js mongodb