MongoDB DBA · Question 10 · Multiple choice

10. Consider a collection called routes with the following index: { "dst_airport": 1, "src_airport": 1, "airline.iata": 1 } Which of the following queries are able to use the index Check all that apply:

Answer options

  1. A.
    db.routes.find({"dst_airport":"JFK", "airline.iata":"EIN"})
  2. B.
    db.routes.find({"src_airport":"JFK"})
  3. C.
    db.routes.find({"airline.iata":"EIN"})
  4. D.
    db.routes.find({"dst_airport":"JFK"})
  5. E.
    db.routes.find({"src_airport":"JFK", "airline.iata":"EIN"})

Answer confidence: High

Correct answer: A, D

Explanation language: Chinese

复合索引靠最左前缀使用:D 只查 dst_airport(首字段)可用;A 查 dst_airport 与 airline.iata,首字段提供索引边界、airline.iata 作为索引内残余过滤,同样算"用了索引"。B、E 从第二字段 src_airport 起头,C 只查第三字段 airline.iata,都缺前缀,无法使用该索引。

Papers containing this question

This question appears in 3 bank records. Public pages combine identical prompts and options. Selected questions display the highest-confidence record; the others show a short preview. Paper-based learning preserves each record's answer, explanation, and confidence.

AUTHOR · PROJECTS · OPEN SOURCE

Author & MongoDB projects

Building data platforms, MongoDB migration and sync tools, and cloud operations products.

Contact the author for any MongoDB needs.

Contact the author ↗mlhp123@outlook.com

Support the author

If this question bank helps you, optional donations are welcome.

Scan with Alipay to support the authorOpen full-size donation image ↗