I know I can set TTL in MongoDB with
db.ttl_collection.ensureIndex( { "Date": 1 }, { expireAfterSeconds: 10 } )
and I know I can ensure index with Scala in Reactivemongo with
collection.indexesManager.ensure(index)
But how can I set TTL collections in reactivemongo from code? Or is there any other way to make expiring records in Mongo with reactivemongo in Scala?
I finally found it out. It's not really clear way to do it but seems to work:
This way every object with expireAfterSeconds: BSONDateTime in this collection will expire after the date specified But I don't even know what these booleans are responsible for.