【发布时间】:2017-10-11 13:11:47
【问题描述】:
我有两张桌子
1.部门集合 2.员工收藏Both the table have unique _id. I have stored multiple employee ids on Department collection.
Employee Collection:
{
_id:"EMP1",
name:"Arjun Singh",
designation:"developer"
},
{
_id:"EMP2",
name:"Hitesh",
designation:"VTS support"
}
Department Collection:
{
_id:"3",
name:"XYZ Department",
employeeList:["EMP1","EMP2"]
}
执行 mongo db 连接后,我需要以下格式的数据
{
_id:"3",
name: "XYZ Department",
employeeList:[
{
_id:"EMP1",
name:"Arjun Singh",
designation:"developer"
},
{
_id:"EMP2",
name:"Hitesh",
designation:"VTS support"
}
]
}
请帮助我如何在 mongoDb 中执行连接
【问题讨论】:
-
您必须提供您的尝试,并指导我们解决特定问题。