python - How to set TTL index for collection in MongoKit? -
i want use 'time live' collection feature (http://docs.mongodb.org/manual/tutorial/expire-data/) in app (flask+mongokit).
it possible create ttl index documents in collection via mongokit when describe models or need use pymongo instead?
thanks
you can use pymongo layer create ttl index documents:
exemple assuming have user mongokit model:
db.user.collection.ensure_index("name", 300)
note ttl deprecated in pymongo 2.3. use cache_for instead.
Comments
Post a Comment