I have a below Document in a Mongo Collection.
{
"_id":"1001",
"country":{
"country_name":"India",
"capital_city":"Delhi",
"national_animal":"tiger",
"national_bird":"peacock",
"states":{
"data":[
{
state_name : "karnataka",
state_capital : "Bangalore"
},
{
state_name : "maharashtra",
state_capital : "Mumbai"
},
{
state_name : "tamilnadu",
state_capital : "Chennai"
}
]
}
},
"country_name":"India",
"root_table":"country"
}
From this JSON, I just wanted an object's key value pair based on the matching filter {"state_name" : "maharashtra"}.
The required result should be like this.
"states" : {
state_name : "maharashtra",
state_capital : "Mumbai"
}
OR
{
state_name : "maharashtra",
state_capital : "Mumbai"
}
Is it possible to achieve this type of query?