Mongodb TTL expires documents early

前端 未结 2 771
臣服心动
臣服心动 2021-02-09 13:15

I am trying insert a document into a Mongo database and have it automatically expire itself after a predetermine time. So far, my document get inserted but always get deleted fr

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-09 14:04

    For Pymongo 3 this is the updated Syntax.

    mongo_collection.create_index("date", expireAfterSeconds=3*60)
    

提交回复
热议问题