[{
"username":"user1",
"products":[
{"productID":1,"itemCode":"CODE1"},
{"productID":2,"itemCode":"CODE1"},
{"productID":3,"itemCode":"CODE2"},
]
},
{
"username":"user2",
"products":[
{"productID":1,"itemCode":"CODE1"},
{"productID":2,"itemCode":"CODE2"},
]
}]
製品の「itemCode」が「CODE1」であるように、「user1」の「products」のすべての「productID」を検索したいと考えています。mongoDBネストされた配列内のドキュメントを検索するクエリ
mongoDBのどのようなクエリを行うべきですか?
私の更新の答えをチェック –
@ ReubenL。 thnx、 – Krisalay