I using mongodb to save my user data along with array. My question is how to retrieve multiple objects that matches the given value in that user array.like this:
{ 
    _id: { objid:'0000000000000' },
    userId: 'abc',
    userItems : [
        {
            itemName: 'mango',
            date: 24,
            month: 1,
            year: 2016
        },
        {
            itemName: 'apple',
            date: 24,
            month: 1,
            year: 2016
        },
        {
            itemName: 'orange',
            date: 22,
            month: 1,
            year: 2016
        },
        {
            itemName: 'vanilla',
            date: 23,
            month: 1,
            year: 2016
        }
    ]
}
and expeccted result is
{
    _id: { objid: '0000000000000' },
    userId: 'abc',
    userItems: [
        {
            itemName: 'mango',
            date: 24,
            month: 1,
            year: 2016
        },
        {
            itemName: 'apple',
            date: 24,
            month: 1,
            year: 2016
        }
    ]
}
I want all the element that matches the date,month,year from this userId userItems array please help me out from this
 
     
     
    