collStats cursor what do they mean


I’m digging through the mongo db metrics and there are those ones:

     "cursor" : {
        "bulk loaded cursor insert calls" : <number>,
        "cache cursors reuse count" : <number>,
        "close calls that result in cache" : <number>,
        "create calls" : <number>,
        "insert calls" : <number>,
        "insert key and value bytes" : <number>,
        "modify" : <number>,
        "modify key and value bytes affected" : <number>,
        "modify value bytes modified" : <number>,
        "next calls" : <number>,
        "open cursor count" : <number>,
        "operation restarted" : <number>,
        "prev calls" : <number>,
        "remove calls" : <number>,
        "remove key bytes removed" : <number>,
        "reserve calls" : <number>,
        "reset calls" : <number>,
        "search calls" : <number>,
        "search near calls" : <number>,
        "truncate calls" : <number>,
        "update calls" : <number>,
        "update key and value bytes" : <number>,
        "update value size change" : <num>

That can be get using collStats.
My question is what is modify key and value bytes affected and all the related key and values bytes metrics, is that the kb/s that is used by the cursor ?
Also what is a cursor there ?
I don’t really get it does this represent the speed at which this collection is reading/writing to the disk ?
Thanks !

Hi @Sacha_Froment welcome to the community!

I believe those are the output of db.collection.stats().wiredTiger.cursor. There’s a documentation page regarding this section:

wiredTiger only appears when using the WiredTiger storage engine.

This document contains data reported directly by the WiredTiger engine and other data for internal diagnostic use.

Basically those are internal WiredTiger metrics, collected for Full Time Diagnostic Data Capture to assist with deep troubleshooting, and typically do not have the equivalent user-tunable settings in MongoDB. Note that in that section, those are for WiredTiger cursor, which is not the same as the accessible MongoDB cursor. In that way, metrics under the wiredTiger section can and have changed between MongoDB versions with little to no warning (since they’re not user-serviceable anyway).

Having said that, are you trying to troubleshoot a specific issue with your MongoDB deployment, or is this a curiosity question?

Best regards

1 Like

Hey @kevinadi ,

Thanks for the detailed answer.
My question is both out of curiosity and to solve a specific problem, I’m trying through the metrics I can gather with collStats (or any other if I can know to which collection it’s related) to know which of my collection is the most used in a specific time window.


Perhaps you’re looking for mongotop?

From the description:

mongotop provides a method to track the amount of time a MongoDB instance mongod spends reading and writing data. mongotop provides statistics on a per-collection level. By default, mongotop returns values every second.

I would recommend you to also check out mongostat which gives a server-wide statistics.

Best regards