How to analize unused mongodb collections

96 views
Skip to first unread message

Kushal Shreyas

unread,
Dec 10, 2019, 1:29:05 AM12/10/19
to mongod...@googlegroups.com
Hi Team,

I need help for the below 2 queries:

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

Kevin Adistambha

unread,
Dec 12, 2019, 9:00:12 PM12/12/19
to mongodb-user

Hi Manu,

    1. Is there any way to get the unused collections details of the last 3 months in Mongo DB server 3.4?

    1. 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

    Reply all
    Reply to author
    Forward
    0 new messages