Database Reference
In-Depth Information
Using this command enables you to get brief statistics of the current database or compare
it with other databases.
Utilizing the collStats command
The output of this command is the same as the dbStats command. Executing the
collStats command returns a collection's statistics, such as index size, number of re-
cords, average object size, and so on.
To execute the command, you should first select your database with the use <dbname>
command and then issue following command:
db.<collection_name>.runCommand("collStats")
The following screenshot shows the output of the preceding command:
Use the preceding command to compare two or more collections' status on a database.
Understanding the serverStatus command
Another useful command to get a report from a database is the serverStatus com-
mand. This command represents a complete report from a database, collections, to the
overall status of the database.
For instance, by issuing this command, you can check the uptime of a server and the serv-
er's local time, hostname, engine version, number of current active connections, and so on.
To use the serverStatus command after choosing the database, run the following
command:
db.runCommand("serverStatus")
Search WWH ::




Custom Search