top
top
top
is an administrative command thatreturns usage statistics for each collection.top
provides amount of time, in microseconds, used and a count ofoperations for the following event types:- total
- readLock
- writeLock
- queries
- getmore
- insert
- update
- remove
- commands
Important
The top
command must be run against amongod instance. Runningtop
against a mongosinstance will return an error.
Issue the top
command against the admindatabase in the form:
- { top: 1 }
Example
At the mongo
shell prompt, use top
with thefollowing invocation:
- db.adminCommand("top")
Alternately you can use top
as follows:
- db.adminCommand( { top: 1 } )
The output of the top command would resemble the followingoutput:
- {
- "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
- }
- }
- }