0
我有MongoDB的查询问题值子查询替换包裹在列表中collaction一种在集合体B MongoDB的关键
有2个集合在我的数据库,名称status
和menu
在status
主键_id
对于买表的值menu
收集
外键对于status
集合:
{
"_id": "green", "description": "running"
}
{
"_id": "yellow", "description": "prepareing"
}
{
"_id": "black", "description": "closing"
}
{
"_id": "red", "description": "repairing"
}
对于menu
集合:
{
"name": "tony",
"bought": [
{
"notebook": "green"
},
{
"cellphone": "red"
}
]
}
{
"name": "andy",
"bought": [
{
"fan": "black"
}
]
}
我怎样才能查询得到以下答案吗?
(只需更换description
为_id
)
{
"name": "tony",
"bought": [
{
"notebook": "running"
},
{
"cellphone": "repairing"
}
]
}
是它的NoSQL子查询问题?我如何使用关键词来谷歌?
谢谢!它对我有用。我也想知道一个更简单的答案。 –