I have the below document structure in MongoDB.
[
{
"network_type": "ex",
"rack": [
{
"xxxx": {
"asn": 111111,
"nodes": {
"business": [
"tt550abcc1eb01"
],
"master": [
"tt550abcc1eb02"
]
},
"region": "ex-01",
"zone": "01a"
},
"yyyy": {
"asn": 22222,
"nodes": {
"business": [
"er44abcc1eb28"
]
},
"region": "ex-02",
"zone": "02a"
}
}
]
}
]
The names inside nodes array of business, master are unique. Is it possible to find the nodes array details by just passing the value "er44abcc1eb28" ? I tried the below query but it didn't work out. Please help.
db.collection.find({"rack.$[].nodes.$[]": "er44abcc1eb28"},{})