MongoDB DBA · 题目 15 · 单选

15. What happens to a document in a TTL index when it expires? Choose the best answer:

题目选项

  1. A.
    It will remain in the collection until the next time it is read, at which point it will be automatically removed instead of returned
  2. B.
    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
  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 be present in the cursors returned by queries until eventually being removed by a background task that runs periodically
  5. E.
    It will be removed immediately

答案置信度:高

正确答案:D

解析语言:中文

TTL 索引不会在查询时把过期文档过滤掉:后台 TTL 线程约每 60 秒扫一次并删除到期文档,在真正删除之前文档仍会被查询和游标返回,所以 D 对。C 的"不再出现在查询中"是最有迷惑性的错误项——MongoDB 没有"逻辑过期"这种语义。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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