I have a set of the value in the array, I need to write a query in the arrays object
Below is my data
{
"groupId":{
"$numberLong":"12345"
},
"detailList":[
{
"Type":"P",
"fromCode":"1000000",
"toCode":"1100000"
},
{
"Type":"P",
"fromCode":"2000000",
"toCode":"2200000"
},
{
"Type":"M",
"fromCode":"3000000",
"toCode":"3300000"
},
{
"Type":"M",
"fromCode":"4000000",
"toCode":"5500000"
}
]
}
I need to fetch the groupId only when my searching criteria matched the range of the fromCode
and toCode
For example:-
If I am searching 1000000-3300000 then there are two types P, M so, I have to return groupId only all the criteria has type P with the searched criteria
What will be the query?