How to remove TTL form MongoDB collection?

前端 未结 1 1931
一向
一向 2021-01-25 04:47

I\'m using mongoose with node.js. I was testing Time-To-Live features and set my documents to expire after X time in the db schema:

var adInfos = new mongoose.Sc         


        
相关标签:
1条回答
  • 2021-01-25 05:22

    Mongoose doesn't ever drop indexes, so if you change the index attributes in your schema they won't take effect until after you manually drop the existing index.

    Not sure what your collection name is, but in the shell it would be something like:

    db.adInfos.dropIndex('created_1')
    

    Use db.adInfos.getIndexes() to see the indexes on the collection.

    0 讨论(0)
提交回复
热议问题