0
我有一個名爲「categories」的集合。我希望能夠找到一個標題爲「果汁」的作品。在定位Juices之後,我希望能夠看到其中的所有項目。查詢具有內部數組的特定屬性的集合
{
"_id": "xibspjSNQLJKurHoT",
"title": "Juices",
"description": "all types of juices",
"items": [
{
"title": "Apple Juice",
"description": "Made with apples",
"healthy": true
},
{
"title": "Orange Juice",
"description": "Made with oranges",
"healthy": true
}
],
"author": "9MJh7d4ELJ9guChvs",
"createdAt": ISODate("2016-01-09T05:03:49.681Z")
},
{
"_id": "xibspjSNQLJKurHoT",
"title": "Meats",
"description": "beef",
"items": [
{
"title": "Chicken",
"description": "Made with chicken",
"healthy": true
}
],
"author": "9MJh7d4ELJ9guChvs",
"createdAt": ISODate("2016-01-09T05:03:49.681Z")
}
我想看到的結果是這樣的
{
"title": "Apple Juice",
"description": "Made with apples",
"healthy": true
},
{
"title": "Orange Juice",
"description": "Made with oranges",
"healthy": true
}
你說的*我要訪問一個名爲「項」 *數組是什麼意思?你能展示預期的結果嗎? – styvane
我增加了更多的細節,我想回來的結果。我是使用嵌入式數據模型的新手。 – Jayswager
可能的重複[如何在MongoDB中選擇單個字段?](http://stackoverflow.com/questions/25589113/how-to-select-a-single-field-in-mongodb) – styvane