Navigation
This version of the documentation is archived and no longer supported.

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

Important

The top command must be run against a mongod instance. Running top against a mongos instance will return an error.

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

{ top: 1 }

Example

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

db.adminCommand("top")

Alternately you can use top as follows:

db.adminCommand( { 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
                  }
          }
}