MongoDB Documentation, Release 3.0.4 Compound Index on an Array Field Compound Index on Fields from an Array of Embedded Documents 8.2. Index Concepts 513 Consider a compound multikey index; i.e. a compound index (page 489) where one of the indexed fields is an array. For example, a collection survey contains documents with a field item and an array field ratings : Create a compound index (page 489) on the item field and the ratings field: The following query specifies a condition on both keys of the index: Taking the predicates separately: MongoDB can compound the two bounds to use the combined bounds of: If an array contains embedded documents, to index on fields contained in the embedded documents, use the dotted field name (page 171) in the index specification. For instance, given the following array of embedded documents: The dotted field name for the score field is "ratings.score" . Compound Bounds of Non-array Field and Field from an Array Consider a collection survey2 contains doc- uments with a field item and an array field ratings : Create a compound index (page 489) on the non-array field item as well as two fields from an array ratings.score and ratings.by : The following query specifies a condition on all three fields: Taking the predicates separately: • the bounds for the item: "XYZ" predicate are [ [ "XYZ", "XYZ" ] ] ; • the bounds for the ratings: { $gte: 3 } predicate are [ [ 3, Infinity ] ] . { _id: 1, item: "ABC", ratings: [ { score: 2, by: "mn" }, { score: 9, by: "anon" } ] } { _id: 2, item: "XYZ", ratings: [ { score: 5, by: "anon" }, { score: 7, by: "wv" } ] } db.survey2.createIndex( { "item": 1, "ratings.score": 1, "ratings.by": 1 } ) ratings: [ { score: 2, by: "mn" }, { score: 9, by: "anon" } ] { item: [ [ "XYZ", "XYZ" ] ], ratings: [ [ 3, Infinity ] ] } db.survey.createIndex( { item: 1, ratings: 1 } ) db.survey.find( { item: "XYZ", ratings: { $gte: 3 } } ) { _id: 1, item: "ABC", ratings: [ 2, 9 ] } { _id: 2, item: "XYZ", ratings: [ 4, 3 ] } db.survey2.find( { item: "XYZ", "ratings.score": { $lte: 5 }, "ratings.by": "anon" } )