When will a mongodb document expire after it is updated?

后端 未结 2 571
闹比i
闹比i 2021-02-05 23:10

I have a collections of documents in mongodb, with the expireAfterSeconds property set on a date-type index.

For the sake of argument, the documents are set

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-05 23:45

    If you don't want to rely on mongo demon process for expiring the collection, then better to create an additional createdOn field on collection and compare it with the current timestamp to decide whether to use that document or not.

提交回复
热议问题