Hi, I'm trying to set expiration date on field in ...
# server
m
Hi, I'm trying to set expiration date on field in my database with kmongo-coroutine driver. My goal is when date is expired whole entry should be removed rom mongo db. But idk how to make it work.
Copy code
override suspend fun setTokenInvalid(refreshToken: String):Boolean {
    collection.createIndex(RefreshToken::refreshToken, IndexOptions().expireAfter(7, TimeUnit.DAYS))

}
I've found solution but in my opinion there is a better solution without using string.
Copy code
collection.createIndex(
    " { expiresAt : 1 } ",
    IndexOptions().expireAfter(60, TimeUnit.SECONDS)
)
m
#kmongo