I have an mongoDB objetc like :
[
{
"items": [
{
"title": "hello",
"options": [
{
"value": "A",
"image": "img1",
"des": "des1"
},
{
"value": "B",
"image": "img2",
"des": "des2"
},
]
}
]
}
]
When I retrieve data from the collection, I want to retrieve only value key from the options of the items array.
Output should look like :
{
"items":[
{
"options" :[
{ "value" :"A" },
{ "value" :"B" },
]
}
]
}
How can i do this?
{ "items.options.value": 1 }see more about projection.turivishalIf you specify the query it would be helpful for me. Thanks{ "items.options.value": 1 }projection simple.