There is one field called getmore for which I need some explanations.
Looking in the documentation gives an idea of the meaning, it states:
The number of get more (i.e. cursor batch) operations per second.
But concretely, what does this exactly mean?
An example by someone who clearly understands the idea may be helpful.
The same goes for the fields dirty and used .
Some simple explanation, maybe with an example, would help to clarify what these are about. Because I am not confident that the interpretation (based on the doc) I have is right.
It’s not quite like that. When you run a database command that gets documents (such as find and aggregate), MongoDB doesn’t necessarily return all the matching documents at once. Instead it returns a batch of say 1,000 documents and a cursor ID. A getMore command is a way to request extra documents from a cursor.
So say you’re using the NodeJS driver and you run collection.find(query).toArray(). This will find all documents matching query and put them into the array. Under the hood, the driver is first running the find database command. Then the driver will keep running getMore commands until the cursor is exhausted and all the documents have been returned.
So, say you have a 10,000 documents in a collection and you want to get them all. And say the batch size is 1,000. This will result in one find command and 9 getMores.
If you have 100 documents and your batch size is 1,000, running a find will never result in a getMore.
findOne will never result in a getMore because the minimum batch size is 1. The it command is a MongoDB Shell helper that actually just runs a getMore on the last cursor. So anytime you run it, getMores will increase.
Depending on what driver you use, you may never need to actually worry about using getMore. Some drivers have methods like toArray() that will handle all the getMore stuff for you under the hood.
As for “used”, that’s the percentage of the WiredTiger cache that is currently used. It goes up when WiredTiger pages in data from disk, and goes down when pages are evicted.