任何人都可以请帮助我想查询mongo来解开数组,我正在使用mongdb本机驱动程序我的收集文件如下,也请忽略我的objectId它只是为了样本
{
"_id":ObjectId(123),
"name":"Sam",
"age":20,
"hobbiesDetail":[
{
"description":"FootBall",
"level":"20%"
},
{
"description":"Cricket",
"level":"80%"
}
]
},
{
"_id":ObjectId(124),
"name":"Ted",
"age":26,
"hobbiesDetail":[
{
"description":"FootBall",
"level":"20%"
}
]
}
我的预期输出是
[
{
"name":"Sam",
"age":20,
"hobbies":"Football,Cricket"
},
{
"name":"Ted",
"age":26,
"hobbies":"Football"
}
]
我只是想放松我的数组并在一个查询中的爱好描述之间添加一个逗号,Thanx以获得任何帮助