How to search in array of object in mongodb
The right way is: db.users.find({awards: {$elemMatch: {award:’National Medal’, year:1975}}}) $elemMatch allows you to match more than one component within the same array element. Without $elemMatch mongo will look for users with National Medal in some year and some award in the year 1975, but not for users with National Medal in 1975. See MongoDB $elemMatch … Read more