I am trying to use MongoDb to return distinct values for details.sub_ap_name when searching details.ap_name is equal to EVPN however my search is returning all the unique values for details.sub_ap_name
Here is what my current query looks like. I have also tried some aggregate searches as well but those are also not working for me as well. Can someonle let me know what I might be doing wrong?
db['test-data'].distinct("details.sub_ap_name",{"details.ap_name": "EVPN"})
here is my data set
{
"_id" : ObjectId("101"),
"details" : [
{
"run_date" : "2021-04-18",
"ap_name" : "EVPN",
"sub_ap_name" : "EVPN TOR"
},
{
"run_date" : "2021-04-18",
"ap_name" : "EVPN",
"sub_ap_name" : "EVPN Mobility"
},
{
"run_date" : "2021-04-17",
"ap_name" : "Multicast",
"sub_ap_name" : "Multicast Layer 2"
}
]
}