here is the example
> db.test.insert({ name: \'test\', values: [ { check: true }, { check: false } ] }) > db.find({ values.check: true })[0]
You can use the $ projection operator to include just the first values array element that matched the query:
$
values
db.test.find({ 'values.check': true }, {name: 1, 'values.$': 1})
returns:
{ "_id": ObjectId("50e22046dc278908f3a38a8e"), "name": "test", "values": [ { "check": true } ] }