Dotted notation accesses fields inside nested documents and values across array elements by joining path components with periods. Quote the complete field path in query filters. section 4.9 section 4.9.1
Use the path form that matches the structure being queried:
- Query a nested field directly, such as "airline.name" and "airline.id". section 4.9.1
- Search any array element with a path such as "prices.price"; MongoDB evaluates that field across the array. section 4.9.3
- Target a specific array position with a numeric component such as "prices.0.price"; array indexes start at zero. section 4.8 section 4.9.3
- Use $elemMatch when multiple conditions must apply to the same embedded array element. section 4.9.3
Filter nested route data
db.routes.find({ "airline.name": "American Airlines", "airline.id": 413 }) This selects routes whose embedded airline has both specified values. For prices below 3000, use { "prices.price": { $lt: 3000 } }. section 4.9.1
Avoid brittle whole-document matches
Matching an entire embedded document requires every field and the expected field order. Prefer dotted paths when omitted, changed, or reordered fields should not invalidate the query. section 4.9.2
Listing 4.18 Using dot notation
db.routes.find({"airline.name": "American Airlines", "airline.id": 413})
Inspect a complete dotted query against nested airline fields. section 4.9.1








