I have documents which further have arrays. I want to query an array returned as a result of a previous query. For example I have
{
{_id : 001,
 data: [{
        value: 1,
        name: 'Roger'
       },
       {value: 2,
        name: 'Albert'
       },
       {value: 3,
        name: 'Allen'
       }]
},
{_id: 002,
data: [{value: 4,
        name: 'Allison'
       },
       {value: 5,
        name: 'Tom'
       }]
}
}
I can get document where _id is equal to 001 but I want to query it's data field where value is equal to 2 and 3. I don't know what is the solution for that. In SQL It could be performed with Sub-queries but I don't know how to do it in mongodb.
 
     
     
     
    