MongoDB – how to query for a nested item inside a collection?
Use dot notation (e.g. advertisers.name) to query and retrieve fields from nested objects: db.agencies.find({ “advertisers.created_at”: { $gte: start, $lt: end } }, { _id: 1, program_ids: 1, “advertisers.name”: 1 } }).limit(1).toArray(); Reference: Retrieving a Subset of Fields and Dot Notation