MongoDB DEV · 题目 202 · 单选

Indexes and Performance: Question 1 What happens to a document in a TTL index when it expires? Choose the best answer:

题目选项

  1. A.
    It will be removed immediately
  2. B.
    It will remain in the collection until the next time it is read, at which point it will be automatically removed instead of returned
  3. C.
    It will no longer show up in queries, but will remain in the collection until eventually being removed by a background task that runs periodically
  4. D.
    It will remain in the collection until the next time it is read, at which point it will be present in the first cursor returned, but automatically removed afterwards
  5. E.
    It will be present in the cursors returned by queries until eventually being removed by a background task that runs periodically

答案置信度:高

正确答案:E

解析语言:中文

TTL 索引由一个约每 60 秒运行一次的后台任务清理过期文档,在真正删除之前文档仍会被查询返回,所以 E 正确。A 立即删除、B/D 读到才删、C 查询看不到但还在,都误解了 TTL 的后台清理机制。

所在套题

此题在题库中有 3 条记录。公开详情合并相同题干和选项;完整公开题展示置信度最高的一条记录,其他题目仅展示摘要。按套学习保留每条记录原有的答案、解析和置信度。

作者 · 作品 · 开源

作者与 MongoDB 作品

专注数据平台、MongoDB 迁移同步与云运维产品研发。

有任何 MongoDB 需求,均可联系作者。

联系作者 ↗mlhp123@outlook.com

支持作者

如果题库对您有帮助,欢迎自愿扫码打赏。

支付宝扫码打赏作者打开打赏原图 ↗