I want to use MongoDB for storing API logs. For this matter, I want to use the approach mentioned here, using weekly or monthly collections for storing logs and dropping them on expiration, therefore I need to be able to set collection names dynamically based on date. Is there any way to do this using mongoengine?
I've tried the meta option on the collection but it does not work since it's only used once when the collection definition is being interpreted and it's not meant to use for my intended behavior.
Also, I'm open to any alternative approach.
I've found that MongoDB has no job scheduling built-in and that mongoengine has no mechanism for changing the name of the collection corresponding to a document class.
Eventually, I found that it's better to use the os job scheduler like cron to handle this kind of task.
links for help: