1. Is there any way to get the unused collections details of the last 3 months in Mongo DB server 3.4?
2. Is there anyway to get when was the collection had one of the CRUD operations operated in Mongodb server 3.4?
Please provide the scripts if any to test the same.
Regards
Manu
Hi Manu,
Is there any way to get the unused collections details of the last 3 months in Mongo DB server 3.4?
Is there anyway to get when was the collection had one of the CRUD operations operated in Mongodb server 3.4?
Most if not all statistics collected in MongoDB are reset in every server restart, so there is no long term view about collection usage.
What you need is probably similar to auditing, but this feature is not available in the community version.
You may be able to store the mongod logs and infer the unused collections from them since mongod records slow queries in the logs. You can specify the logs to store all queries. Note that this approach would require you to store a lot of logs, which may or may not be feasible for your use case.
In conclusion, unfortunately the functionality you’re looking for is not built into MongoDB. However they could be implemented in your app instead, where you can have a fine grained control over what statistics you want to capture regarding your data operations.
Best regards,
Kevin