I use mongodb to store 30-day data that comes to me as a stream. I am looking for a cleaning mechanism with which I can throw away the oldest data to create a place for new data. I used mysql in which I handled this situation using partitions. I had 30 sections based on date. I delete the oldest pending partition and create a new partition to store new data.
When I match the same thing in mongodb, it seems to me that I'm using date-based "shards". But the problem is that it affects data distribution badly. If all the new data is in one fragment, then this fragment will be so hot that there are many people who access it, and fragments containing older data will be less loaded by users.
I can have collection-based cleanup. I can have 30 collections, and I can throw away the oldest collection to post new data. But a couple of problems: 1) If I make the collection smaller, then I can not benefit from the fragments, since they are made for each collection. 2) My requests should change to a request from all 30 collections and accept the union.
Please offer me a good cleaning mechanism (if any) to handle this situation.
mongodb database-design
user472402
source share