MongoDB DBA · Question 337 · Multiple choice

56. Which of the following documents below from the sample collection will be returned by this query? db.sample.find({ "a": { "$gt": 5 } }) Check all that apply:

Answer options

  1. A.
    { "_id": 33493, "a": [ 5 ] }
  2. B.
    { "_id": 27389, "a": [ 2, 3, 5 ] }
  3. C.
    { "_id": 11433, "a": [ 5, 10, 15 ] }
  4. D.
    { "_id": 53471,"a": 6 }
  5. E.
    { "_id": 22345, "a": [ 10, 20 ] }

Answer confidence: High

Correct answer: C, D, E

Explanation language: Chinese

数组字段上的 {"a":{$gt:5}} 只要有任意一个元素大于 5 就匹配(数组元素会被逐个比较)。C 含 10、15,D 是标量 6,E 含 10、20,都命中;A 只有 5,B 最大值为 5,没有任何元素大于 5,不返回。

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 ↗