node.js - Mongodb, mongoose - dynamically set TTL time -
I am referring to this question to ask: Is it possible to dynamically set TTL time for MongoDB is? So suppose you have tokens collection and you want to use it for different purposes. In that case every time you make tokens, it is best to set specific TTLs for each token. If this is possible, can you please provide some code snippets?
If you index a TTL on a collection, then periodically from the MongoDB archive The documents will be removed (). Db.events.ensureIndex ('time', = 3600 after expiration)
This uses a indexing system to handle TTL, its definite, for every document it is dynamic There is no way to define form. In your scenario, I advise you to use Morphody along with messaging like RabbitMak
Comments
Post a Comment