Hi,
I'd like to use mongodb's TTL idexes to auto-expire documents. This seems to work fine using Eve's mongo_indexes as follows.
# settings.py
my_resource = {
'mongo_indexes': {'expire_at': ([('expireAt', 1)], {"expireAfterSeconds": 0})},
'schema': { 'expireAt': { 'type': 'datetime' }}
}
It works fine as long as I have the 'expireAt' in the HTTP POST request payload.
What I'd like to do, however, is to define the expireAt on the server side. So I tried using the event hooks. With pre POST hook I can't modify the request, so it seems to be no go.
With pre insert db hook I am able to add 'expireAt' just fine but for some reason the TTL feature is not working in this case and the documents won't be automatically deleted.
Any idea how to get TTL working without client posting 'expireAt'?
-Mikko-