Retrive data from mongo by passing Embedded document values as Input

Hi,
Here I am retrieving the values from the mongo DB by passing the Input as the array values into the find ( ) statement.

Method: 1

Use the Dot Notation to get the values from the Array by giving Object_name(array_name).column_name in the below manner.


db.studentDetails.find(
        {
        'Address.State' : "Telangana"
        }

 )

Method: 2

Note: To pass array values as input, one should pass all the values and of the array in an order in which they have inserted.


db.studentDetails.find
(
    {
        Address:
        {
            Street:"Gandhi Road",
            City:"Hyderbad",
            State:"Telangana"
        }
     }
       )