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子查詢問題?我如何使用關鍵詞來谷歌?
謝謝!它對我有用。我也想知道一個更簡單的答案。 –