I am trying to get Mongo to delete documents using the TTL function, but to no avail. Tried a lot of things, but mongo doesn't seem like cleaning up.
My index:
{
"v" : 1,
"key" : {
"date" : 1
},
"name" : "date_1",
"ns" : "history.history",
"expireAfterSeconds" : 60
}
Date value from document:
"date" : "2016-09-29 11:08:46.461207",
Output from db.serverStatus (). metrics.ttl:
{ "deletedDocuments" : NumberLong(0), "passes" : NumberLong(29) }
Time output from db.serverStatus ():
"localTime" : ISODate("2016-09-29T11:19:45.345Z")
The only thing I suspect is how I insert the value from Python. Maybe this is somewhat wrong. I have a JSON document that contains the following element:
"date": str(datetime.utcnow()),
Any clues where the problem might occur?
Thank you Janis
source
share