Wanted to check number of insert happening to a collection in daily basis

Hi Experts,

wanted to know if there are any way we can check number of DML happening in collections.

Any help will be appriciated.


Hey @Prince_Das,

There are a number of ways you can use to check DML happening in a collection. You can try using mongostat which provides a quick overview of running instances and mongotop which provides statistics on a per-collection level.

You can also try using change streams in MongoDB which allows applications to access real-time data changes. With change streams, you can track data changes in a single collection, a database, or even an entire deployment. For the insert operation, the change event will give an output like this:

   "_id": { <Resume Token> },
   "operationType": "insert",
   "ns": {
      "db": "example",
      "coll": "testing"
   "fullDocument": {
      "_id": ObjectId("599af247bb69cd81261c345f"),

Here, the ns field shows the namespace (database and or collection) affected by the event.



This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.