June 2014
Intermediate to advanced
696 pages
38h 52m
English
Another great feature of the Admin object is the ability to get status information about the MongoDB server. This information includes the hostname, version, uptime, open cursors, and much more. You can use this information to determine the health and status of the MongoDB server and then make adjustments in your code to handle problem situations.
To display the status of the MongoDB server, you use the serverStatus() method on the Admin object. Listing 13.4 illustrates how to create the Admin object and then call serverStatus(). Figure 13.4 shows the results of Listing 13.4.
Listing 13.4 db_status.js: Retrieving and displaying the MongoDB server status
1 var MongoClient ...
Read now
Unlock full access