Navigation
This version will reach end of life on Feb 2018. To upgrade, go to the Learn more about upgrading your version of MongoDB.

top

On this page

top

top is an administrative command that returns usage statistics for each collection. top provides amount of time, in microseconds, used and a count of operations for the following event types:

  • total
  • readLock
  • writeLock
  • queries
  • getmore
  • insert
  • update
  • remove
  • commands

Issue the top command against the admin database in the form:

{ top: 1 }

Example

At the mongo shell prompt, use top with the following evocation:

db.adminCommand("top")

Alternately you can use top as follows:

use admin
db.runCommand( { top: 1 } )

The output of the top command would resemble the following output:

{
  "totals" : {
     "records.users" : {
                  "total" : {
                          "time" : 305277,
                          "count" : 2825
                  },
                  "readLock" : {
                          "time" : 305264,
                          "count" : 2824
                  },
                  "writeLock" : {
                          "time" : 13,
                          "count" : 1
                  },
                  "queries" : {
                          "time" : 305264,
                          "count" : 2824
                  },
                  "getmore" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "insert" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "update" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "remove" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "commands" : {
                          "time" : 0,
                          "count" : 0
                  }
          }
}
←   validate whatsmyuri  →