log4mongo / log4mongo-python

python logging handler for mongo database
http://log4mongo.org
Other
111 stars 37 forks source link

timestamp is of type BSON Timestamp, instead it should be of type BSON Date #19

Closed dmsquires closed 8 years ago

dmsquires commented 8 years ago

Setting up a TTL on log4mongo-python logs does not work on type Timestamp (which is what is logged by default in log4mongo-python). 10gen recommends Timestamp type is not used externally. Type Date is used for TTL:

https://docs.mongodb.com/manual/reference/bson-types/

Note

The BSON timestamp type is for internal MongoDB use. For most cases, in application development, you will want to use the BSON date type. See Date for more information.

https://docs.mongodb.com/manual/tutorial/expire-data/

oz123 commented 8 years ago

Yes, you are correct. The API for python says the following:

expireAfterSeconds: Used to create an expiring (TTL) collection. MongoDB will automatically delete documents from this collection after seconds. The indexed field must be a UTC datetime or the data will not expire.