Another extremely useful shell method used to gather information about the state of the database server is db.serverStatus(). This shell method is a wrapper for the serverStatus. database command. As with the stats() method described in the previous sub-section, this utility provides literally hundreds of statistics. An explanation of all of them is simply beyond what this book is able to cover.
For a complete list of all output information, please see the documentation under serverStatus/Output (https://docs.mongodb.com/manual/reference/command/serverStatus/#output).
Here is a screenshot of the first few statistics:
Here is a brief summary of the more important statistics:
db.serverStatus() statistic | Notes |
version | The version of MongoDB running on this server. |
uptime | The number of seconds this server has been running. |
electionMetrics | This pertains to the functioning of a replica set and is covered in more detail in Chapter 13, Deploying a Replica... |