Docs Menu
Docs Home
/
MongoDB Manual
/ / /

serverStatus

On this page

  • Definition
  • Compatibility
  • Syntax
  • Behavior
  • Initialization
  • Include mirroredReads
  • Output
  • asserts
  • bucketCatalog
  • catalogStats
  • changeStreamPreImages
  • connections
  • defaultRWConcern
  • electionMetrics
  • extra_info
  • flowControl
  • globalLock
  • hedgingMetrics
  • indexBuilds
  • indexBulkBuilder
  • indexStats
  • Instance Information
  • locks
  • logicalSessionRecordCache
  • mem
  • metrics
  • mirroredReads
  • network
  • opLatencies
  • opReadConcernCounters
  • opWriteConcernCounters
  • opcounters
  • opcountersRepl
  • oplogTruncation
  • planCache
  • queryStats
  • queryAnalyzers
  • queues
  • Queue Information
  • querySettings
  • readConcernCounters
  • readPreferenceCounters
  • repl
  • security
  • sharding
  • shardingStatistics
  • shardedIndexConsistency
  • storageEngine
  • tcmalloc
  • transactions
  • transportSecurity
  • watchdog
  • wiredTiger
serverStatus

The serverStatus command returns a document that provides an overview of the database's state. Monitoring applications can run this command at a regular interval to collect statistics about the instance.

This command is available in deployments hosted in the following environments:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

Note

This command is supported in all MongoDB Atlas clusters. For information on all commands, see Unsupported Commands.

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB

  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB

The command has the following syntax:

db.runCommand(
{
serverStatus: 1
}
)

The value (i.e. 1 above) does not affect the operation of the command. The db.serverStatus() command returns a large amount of data. To return a specific object or field from the output append the object or field name to the command.

For example:

db.runCommand({ serverStatus: 1}).metrics
db.runCommand({ serverStatus: 1}).metrics.commands
db.runCommand({ serverStatus: 1}).metrics.commands.update

mongosh provides the db.serverStatus() wrapper for the serverStatus command.

Tip

See also:

Much of the output of serverStatus is also displayed dynamically by mongostat. See the mongostat command for more information.

By default, serverStatus excludes in its output:

To include fields that are excluded by default, specify the top-level field and set it to 1 in the command. To exclude fields that are included by default, specify the field and set to 0. You can specify either top-level or embedded fields.

For example, the following operation excludes the repl, metrics and locks information in the output.

db.runCommand( { serverStatus: 1, repl: 0, metrics: 0, locks: 0 } )

For example, the following operation excludes the embedded histogram field in the output.

db.runCommand( { serverStatus: 1, metrics: { query: { multiPlanner: { histograms: false } } } } )

The following example includes all repl information in the output:

db.runCommand( { serverStatus: 1, repl: 1 } )

The statistics reported by serverStatus are reset when the mongod server is restarted.

This command will always return a value, even on a fresh database. The related command db.serverStatus() does not always return a value unless a counter has started to increment for a particular metric.

After you run an update query, db.serverStatus() and db.runCommand({ serverStatus: 1}) both return the same values.

{
arrayFilters : Long("0"),
failed : Long("0"),
pipeline : Long("0"),
total : Long("1")
}

By default, the mirroredReads information is not included in the output. To return mirroredReads information, you must explicitly specify the inclusion:

db.runCommand( { serverStatus: 1, mirroredReads: 1 } )

Note

The output fields vary depending on the version of MongoDB, underlying operating system platform, the storage engine, and the kind of node, including mongos, mongod or replica set member.

For the serverStatus output specific to the version of your MongoDB, refer to the appropriate version of the MongoDB Manual.

asserts : {
regular : <num>,
warning : <num>,
msg : <num>,
user : <num>,
rollovers : <num>
},
asserts

A document that reports on the number of assertions raised since the MongoDB process started. Assertions are internal checks for errors that occur while the database is operating and can help diagnose issues with the MongoDB server. Non-zero asserts values indicate assertion errors, which are uncommon and not an immediate cause for concern. Errors that generate asserts can be recorded in the log file or returned directly to a client application for more information.

asserts.regular

The number of regular assertions raised since the MongoDB process started. Examine the MongoDB log for more information.

asserts.warning

This field always returns zero 0.

asserts.msg

The number of message assertions raised since the MongoDB process started. Examine the log file for more information about these messages.

asserts.user

The number of "user asserts" that have occurred since the last time the MongoDB process started. These are errors that user may generate, such as out of disk space or duplicate key. You can prevent these assertions by fixing a problem with your application or deployment. Examine the log file for more information about these messages.

asserts.rollovers

The number of times that the assert counters have rolled over since the last time the MongoDB process started. The counters will roll over to zero after 2 30 assertions. Use this value to provide context to the other values in the asserts data structure.

bucketCatalog : {
numBuckets : <num>,
numOpenBuckets : <num>,
numIdleBuckets : <num>,
memoryUsage : <num>
}

New in version 5.0.

A document that reports metrics related to the internal storage of time series collections.

The bucketCatalog returns the following metrics:

Metric
Description
numBuckets
The number of buckets that store time series data internally.
numOpenBuckets
The number of active, uncommitted writes to buckets.
numIdleBuckets
The number of buckets that are not full and can store incoming time series data.
memoryUsage
The number of bytes used by internal bucketing data structures.

New in version 5.1.

catalogStats: {
collections: <num>,
capped: <num>,
views: <num>,
timeseries: <num>,
internalCollections: <num>,
internalViews: <num>
}
catalogStats

A document that reports statistics on collection usage via collection counts.

catalogStats.collections

The total number of user collections (not including system collections).

catalogStats.capped

The total number of capped user collections.

catalogStats.views

The total number of user views.

catalogStats.timeseries

The total number of time series collections.

catalogStats.internalCollections

The total number of system collections (collections on the config, admin, or local databases).

catalogStats.internalViews

The total number of views of system collections (collections on the config, admin, or local databases).

New in version 5.0.

changeStreamPreImages : {
purgingJob : {
totalPass : <num>,
docsDeleted : <num>,
bytesDeleted : <num>,
scannedCollections : <num>,
scannedInternalCollections : <num>,
maxStartWallTimeMillis : <num>,
timeElapsedMillis : <num>,
},
expireAfterSeconds : <num>
}

A document that reports metrics related to change stream pre-images.

changeStreamPreImages.purgingJob

New in version 7.1.

A document that reports metrics related to the purging jobs for change stream pre-images. Purging jobs are background processes that the system uses to remove pre-images asynchronously.

The changeStreamPreImages.purgingJob field returns the following metrics:

Metric
Description
totalPass
Total number of deletion passes completed by the purging job.
docsDeleted
Cumulative number of pre-image documents deleted by the purging job.
bytesDeleted
Cumulative size in bytes of all deleted documents from all pre-image collections by the purging job.
scannedCollections

Cumulative number of pre-image collections scanned by the purging job.

Note

In single-tenant environments, this number is the same as totalPass since each tenant has one pre-image collection.

scannedInternalCollections
Cumulative number of internal pre-image collections scanned by the purging job. Internal collections are the collections within the pre-image collections stored in config.system.preimages.
maxStartWallTimeMillis
Maximum wall time in milliseconds from the first document of each pre-image collection.
timeElapsedMillis
Cumulative time in milliseconds of all deletion passes by the purging job.
changeStreamPreImages.expireAfterSeconds

New in version 7.1.

Amount of time in seconds that MongoDB retains pre-images. If expireAfterSeconds is not defined, this metric does not appear in the serverStatus output.

connections : {
current : <num>,
available : <num>,
totalCreated : <num>,
rejected : <num>, // Added in MongoDB 6.3
active : <num>,
threaded : <num>,
exhaustIsMaster : <num>,
exhaustHello : <num>,
awaitingTopologyChanges : <num>,
loadBalanced : <num>
},
connections

A document that reports on the status of the connections. Use these values to assess the current load and capacity requirements of the server.

connections.current

The number of incoming connections from clients to the database server. This number includes the current shell session. Consider the value of connections.available to add more context to this datum.

The value will include all incoming connections including any shell connections or connections from other servers, such as replica set members or mongos instances.

connections.available

The number of unused incoming connections available. Consider this value in combination with the value of connections.current to understand the connection load on the database, and the UNIX ulimit Settings for Self-Managed Deployments document for more information about system thresholds on available connections.

connections.totalCreated

Count of all incoming connections created to the server. This number includes connections that have since closed.

connections.rejected

New in version 6.3.

The number of incoming connections the server rejected because the server doesn't have the capacity to accept additional connections or the net.maxIncomingConnections setting is reached.

connections.active

The number of active client connections to the server. Active client connections refers to client connections that currently have operations in progress.

connections.threaded

The number of incoming connections from clients that are assigned to threads that service client requests.

New in version 5.0.

connections.exhaustIsMaster

The number of connections whose last request was an isMaster request with exhaustAllowed.

Note

If you are running MongoDB 5.0 or later, do not use the isMaster command. Instead, use hello.

connections.exhaustHello

The number of connections whose last request was a hello request with exhaustAllowed.

New in version 5.0.

connections.awaitingTopologyChanges

The number of clients currently waiting in a hello or isMaster request for a topology change.

Note

If you are running MongoDB 5.0 or later, do not use the isMaster command. Instead, use hello.

connections.loadBalanced

New in version 5.3.

The current number of incoming connections received through the load balancer.

The defaultRWConcern section provides information on the local copy of the global default read or write concern settings. The data may be stale or out of date. See getDefaultRWConcern for more information.

defaultRWConcern : {
defaultReadConcern : {
level : <string>
},
defaultWriteConcern : {
w : <string> | <int>,
wtimeout : <int>,
j : <bool>
},
defaultWriteConcernSource: <string>,
defaultReadConcernSource: <string>,
updateOpTime : Timestamp,
updateWallClockTime : Date,
localUpdateWallClockTime : Date
}
defaultRWConcern

The last known global default read or write concern settings.

defaultRWConcern.defaultReadConcern

The last known global default read concern setting.

If serverStatus does not return this field, the global default read concern has either not been set or has not yet propagated to the instance.

defaultRWConcern.defaultReadConcern.level

The last known global default read concern level setting.

If serverStatus does not return this field, the global default for this setting has either not been set or has not yet propagated to the instance.

defaultRWConcern.defaultWriteConcern

The last known global default write concern setting.

If serverStatus does not return this field, the global default write concern has either not been set or has not yet propagated to the instance.

defaultRWConcern.defaultWriteConcern.w

The last known global default w setting.

If serverStatus does not return this field, the global default for this setting has either not been set or has not yet propagated to the instance.

defaultRWConcern.defaultWriteConcern.wtimeout

The last known global default wtimeout setting.

If serverStatus does not return this field, the global default for this setting has either not been set or has not yet propagated to the instance.

defaultRWConcern.defaultWriteConcernSource

The source of the default write concern. By default, the value is "implicit". Once you set the default write concern with setDefaultRWConcern, the value becomes "global".

New in version 5.0.

defaultRWConcern.defaultReadConcernSource

The source of the default read concern. By default, the value is "implicit". Once you set the default read concern with setDefaultRWConcern, the value becomes "global".

New in version 5.0.

defaultRWConcern.updateOpTime

The timestamp when the instance last updated its copy of any global read or write concern settings. If the defaultRWConcern.defaultReadConcern and defaultRWConcern.defaultWriteConcern fields are absent, this field indicates the timestamp when the defaults were last unset.

defaultRWConcern.updateWallClockTime

The wall clock time when the instance last updated its copy of any global read or write concern settings. If the defaultRWConcern.defaultReadConcern and defaultRWConcern.defaultWriteConcern fields are absent, this field indicates the time when the defaults were last unset.

defaultRWConcern.localUpdateWallClockTime

The local system wall clock time when the instance last updated its copy of any global read or write concern setting. If this field is the only field under defaultRWConcern, the instance has never had knowledge of a global default read or write concern setting.

The electionMetrics section provides information on elections called by this mongod instance in a bid to become the primary:

electionMetrics : {
stepUpCmd : {
called : Long("<num>"),
successful : Long("<num>")
},
priorityTakeover : {
called : Long("<num>"),
successful : Long("<num>")
},
catchUpTakeover : {
called : Long("<num>"),
successful : Long("<num>")
},
electionTimeout : {
called : Long("<num>"),
successful : Long("<num>")
},
freezeTimeout : {
called : Long("<num>"),
successful : Long("<num>")
},
numStepDownsCausedByHigherTerm : Long("<num>"),
numCatchUps : Long("<num>"),
numCatchUpsSucceeded : Long("<num>"),
numCatchUpsAlreadyCaughtUp : Long("<num>"),
numCatchUpsSkipped : Long("<num>"),
numCatchUpsTimedOut : Long("<num>"),
numCatchUpsFailedWithError : Long("<num>"),
numCatchUpsFailedWithNewTerm : Long("<num>"),
numCatchUpsFailedWithReplSetAbortPrimaryCatchUpCmd : Long("<num>"),
averageCatchUpOps : <double>
}
electionMetrics.stepUpCmd

Metrics on elections that were called by the mongod instance as part of an election handoff when the primary stepped down.

The stepUpCmd includes both the number of elections called and the number of elections that succeeded.

electionMetrics.priorityTakeover

Metrics on elections that were called by the mongod instance because its priority is higher than the primary's.

The electionMetrics.priorityTakeover includes both the number of elections called and the number of elections that succeeded.

electionMetrics.catchUpTakeover

Metrics on elections called by the mongod instance because it is more current than the primary.

The catchUpTakeover includes both the number of elections called and the number of elections that succeeded.

electionMetrics.electionTimeout

Metrics on elections called by the mongod instance because it has not been able to reach the primary within settings.electionTimeoutMillis.

The electionTimeout includes both the number of elections called and the number of elections that succeeded.

electionMetrics.freezeTimeout

Metrics on elections called by the mongod instance after its freeze period (during which the member cannot seek an election) has expired.

The electionMetrics.freezeTimeout includes both the number of elections called and the number of elections that succeeded.

electionMetrics.numStepDownsCausedByHigherTerm

Number of times the mongod instance stepped down because it saw a higher term (specifically, other member(s) participated in additional elections).

electionMetrics.numCatchUps

Number of elections where the mongod instance as the newly-elected primary had to catch up to the highest known oplog entry.

electionMetrics.numCatchUpsSucceeded

Number of times the mongod instance as the newly-elected primary successfully caught up to the highest known oplog entry.

electionMetrics.numCatchUpsAlreadyCaughtUp

Number of times the mongod instance as the newly-elected primary concluded its catchup process because it was already caught up when elected.

electionMetrics.numCatchUpsSkipped

Number of times the mongod instance as the newly-elected primary skipped the catchup process.

electionMetrics.numCatchUpsTimedOut

Number of times the mongod instance as the newly-elected primary concluded its catchup process because of the settings.catchUpTimeoutMillis limit.

electionMetrics.numCatchUpsFailedWithError

Number of times the newly-elected primary's catchup process failed with an error.

electionMetrics.numCatchUpsFailedWithNewTerm

Number of times the newly-elected primary's catchup process concluded because another member(s) had a higher term (specifically, other member(s) participated in additional elections).

electionMetrics.numCatchUpsFailedWithReplSetAbortPrimaryCatchUpCmd

Number of times the newly-elected primary's catchup process concluded because the mongod received the replSetAbortPrimaryCatchUp command.

electionMetrics.averageCatchUpOps

Average number of operations applied during the newly-elected primary's catchup processes.

extra_info : {
note : 'fields vary by platform',
page_faults : <num>
},
extra_info

A document that provides additional information about the underlying system.

extra_info.note

A string with the text 'fields vary by platform'

extra_info.page_faults

The total number of page faults. The extra_info.page_faults counter may increase dramatically during moments of poor performance and may correlate with limited memory environments and larger data sets. Limited and sporadic page faults do not necessarily indicate an issue.

Windows differentiates "hard" page faults involving disk I/O from "soft" page faults that only require moving pages in memory. MongoDB counts both hard and soft page faults in this statistic.

flowControl : {
enabled : <boolean>,
targetRateLimit : <int>,
timeAcquiringMicros : Long("<num>"),
locksPerKiloOp : <double>,
sustainerRate : <int>,
isLagged : <boolean>,
isLaggedCount : <int>,
isLaggedTimeMicros : Long("<num>")
},
flowControl

A document that returns statistics on the Flow Control. With flow control enabled, as the majority commit point lag grows close to the flowControlTargetLagSeconds, writes on the primary must obtain tickets before taking locks. As such, the metrics returned are meaningful when run on the primary.

flowControl.enabled

A boolean that indicates whether Flow Control is enabled (true) or disabled (false).

See also enableFlowControl.

flowControl.targetRateLimit

When run on the primary, the maximum number of tickets that can be acquired per second.

When run on a secondary, the returned number is a placeholder.

flowControl.timeAcquiringMicros

When run on the primary, the total time write operations have waited to acquire a ticket.

When run on a secondary, the returned number is a placeholder.

flowControl.locksPerKiloOp

When run on the primary, an approximation of the number of locks taken per 1000 operations.

When run on a secondary, the returned number is a placeholder.

flowControl.sustainerRate

When run on the primary, an approximation of operations applied per second by the secondary that is sustaining the commit point.

When run on a secondary, the returned number is a placeholder.

flowControl.isLagged

When run on the primary, a boolean that indicates whether flow control has engaged. Flow control engages when the majority committed lag is greater than some percentage of the configured flowControlTargetLagSeconds.

Replication lag can occur without engaging flow control. An unresponsive secondary might lag without the replica set receiving sufficient load to engage flow control, leaving the flowControl.isLagged value at false.

For additional information, see Flow Control.

flowControl.isLaggedCount

When run on a primary, the number of times flow control has engaged since the last restart. Flow control engages when the majority committed lag is greater than some percentage of the flowControlTargetLagSeconds.

When run on a secondary, the returned number is a placeholder.

flowControl.isLaggedTimeMicros

When run on the primary, the amount of time flow control has spent being engaged since the last restart. Flow control engages when the majority committed lag is greater than some percentage of the flowControlTargetLagSeconds.

When run on a secondary, the returned number is a placeholder.

globalLock : {
totalTime : Long("<num>"),
currentQueue : {
total : <num>,
readers : <num>,
writers : <num>
},
activeClients : {
total : <num>,
readers : <num>,
writers : <num>
}
},
globalLock

A document that reports on the database's lock state.

Generally, the locks document provides more detailed data on lock uses.

globalLock.totalTime

The time, in microseconds, since the database last started and created the globalLock. This is approximately equivalent to the total server uptime.

globalLock.currentQueue

A document that provides information concerning the number of operations queued because of a lock.

globalLock.currentQueue.total

The total number of operations queued waiting for the lock (i.e., the sum of globalLock.currentQueue.readers and globalLock.currentQueue.writers).

A consistently small queue, particularly of shorter operations, should cause no concern. The globalLock.activeClients readers and writers information provides context for this data.

globalLock.currentQueue.readers

The number of operations that are currently queued and waiting for the read lock. A consistently small read queue, particularly of shorter operations, should cause no concern.

globalLock.currentQueue.writers

The number of operations that are currently queued and waiting for the write lock. A consistently small write queue, particularly of shorter operations, is no cause for concern.

globalLock.activeClients

A document that provides information about the number of connected clients and the read and write operations performed by these clients.

Use this data to provide context for the globalLock.currentQueue data.

globalLock.activeClients.total

The total number of internal client connections to the database including system threads as well as queued readers and writers. This metric will be higher than the total of activeClients.readers and activeClients.writers due to the inclusion of system threads.

globalLock.activeClients.readers

The number of the active client connections performing read operations.

globalLock.activeClients.writers

The number of active client connections performing write operations.

Important

Starting in MongoDB 8.0, hedged reads are deprecated. Queries that specify the read preference nearest no longer use hedged reads by default. If you explicitly specify a hedged read, MongoDB performs a hedged read and logs a warning.

For mongos instances only.

hedgingMetrics : {
numTotalOperations : <num>,
numTotalHedgedOperations : <num>,
numAdvantageouslyHedgedOperations : <num>
},
hedgingMetrics

Provides metrics on hedged reads for the mongos instance.

For mongos instances only.

hedgingMetrics.numTotalOperations

The total number of the operations issued with the hedged read option enabled to this mongos instance.

For mongos instances only.

hedgingMetrics.numTotalHedgedOperations

The number of all operations for which the mongos instance hedged the read operation; i.e. sent the operation to an additional member of each queried shard.

For mongos instances only.

hedgingMetrics.numAdvantageouslyHedgedOperations

The total number of the operation where the additional read sent to hedge the read operation fulfilled the client request.

For mongos instances only.

indexBuilds : {
total : <num>,
killedDueToInsufficientDiskSpace : <num>,
failedDueToDataCorruption : <num>
},
indexBuilds

Provides metrics on index builds after the server last started.

indexBuilds.total

Total number of index builds.

indexBuilds.killedDueToInsufficientDiskSpace

Total number of index builds that were ended because of insufficient disk space. Starting in MongoDB 7.1, you can set the minimum amount of disk space required for building indexes using the indexBuildMinAvailableDiskSpaceMB parameter.

New in version 7.1.

indexBuilds.failedDueToDataCorruption

Total number of index builds that failed because of data corruption.

New in version 7.1.

indexBulkBuilder: {
count: <long>,
resumed: <long>,
filesOpenedForExternalSort: <long>,
filesClosedForExternalSort: <long>,
spilledRanges: <long>,
bytesSpilledUncompressed: <long>,
bytesSpilled: <long>,
numSorted: <long>,
bytesSorted: <long>,
memUsage: <long>
}
indexBulkBuilder

Provides metrics for index bulk builder operations. Use these metrics to diagnose index build issues with createIndexes, collection cloning during initial sync, index builds that resume after startup, and statistics on disk usage by the external sorter.

indexBuildBuilder.bytesSpilled

New in version 6.0.4.

The number of bytes written to disk by the external sorter.

indexBuilder.bytesSpilledUncompressed

New in version 6.0.4.

The number of bytes to be written to disk by the external sorter before compression.

indexBulkBuilder.count

The number of instances of the bulk builder created.

indexBulkBuilder.filesClosedForExternalSort

The number of times the external sorter closed a file handle to spill data to disk. Combine this value with filesOpenedForExternalSort to determine the number of open file handles in use by the external sorter.

indexBulkBuilder.filesOpenedForExternalSort

The number of times the external sorter opened a file handle to spill data to disk. Combine this value with filesClosedForExternalSort to determine the number of open file handles in use by the external sorter.

indexBulkBuilder.resumed

The number of times the bulk builder was created for a resumable index build.

indexBulkBuilder.spilledRanges

New in version 6.0.4.

The number of times the external sorter spilled to disk.

indexBulkBuilder.numSorted

New in version 6.3.

The total number of sorted documents.

indexBulkBuilder.bytesSorted

New in version 6.3.

The total number of bytes for sorted documents. For example, if a total of 10 documents were sorted and each document is 20 bytes, the total number of bytes sorted is 200.

indexBulkBuilder.memUsage

New in version 6.3.

The current bytes of memory allocated for building indexes.

indexStats: {
count: Long("<num>"),
features: {
'2d': { count: Long("<num>"), accesses: Long("<num>") },
'2dsphere': { count: Long("<num>"), accesses: Long("<num>") },
'2dsphere_bucket': { count: Long("<num>"), accesses: Long("<num>") },
collation: { count: Long("<num>"), accesses: Long("<num>") },
compound: { count: Long("<num>"), accesses: Long("<num>") },
hashed: { count: Long("<num>"), accesses: Long("<num>") },
id: { count: Long("<num>"), accesses: Long("<num>") },
normal: { count: Long("<num>"), accesses: Long("<num>") },
partial: { count: Long("<num>"), accesses: Long("<num>") },
single: { count: Long("<num>"), accesses: Long("<num>") },
sparse: { count: Long("<num>"), accesses: Long("<num>") },
text: { count: Long("<num>"), accesses: Long("<num>") },
ttl: { count: Long("<num>"), accesses: Long("<num>") },
unique: { count: Long("<num>"), accesses: Long("<num>") },
wildcard: { count: Long("<num>"), accesses: Long("<num>") }
}
}
indexStats

A document that reports statistics on all indexes on databases and collections.

New in version 6.0.

indexStats.count

The total number of indexes.

New in version 6.0.

indexStats.features

A document that provides counters for each index type and the number of accesses on each index. Each index type under indexStats.features has a count field that counts the total number of indexes for that type, and an accesses field that counts the number of accesses on that index.

New in version 6.0.

host : <string>,
advisoryHostFQDNs : <array>,
version : <string>,
process : <'mongod'|'mongos'>,
service : <'router'|'shard'>,
pid : Long("<num>"),
uptime : <num>,
uptimeMillis : Long("<num>"),
uptimeEstimate : Long("<num>"),
localTime : ISODate("<Date>"),
host

The system's hostname. In Unix/Linux systems, this should be the same as the output of the hostname command.

advisoryHostFQDNs

An array of the system's fully qualified domain names (FQDNs).

version

The MongoDB version of the current MongoDB process.

process

The current MongoDB process. Possible values are: mongos or mongod.

service

The role of the current MongoDB process. Possible values are router or shard.

New in version 8.0.

pid

The process ID number.

uptime

The number of seconds that the current MongoDB process has been active.

uptimeMillis

The number of milliseconds that the current MongoDB process has been active.

uptimeEstimate

The uptime in seconds as calculated from MongoDB's internal course-grained time keeping system.

localTime

The ISODate representing the current time, according to the server, in UTC.

locks : {
<type> : {
acquireCount : {
<mode> : Long("<num>"),
...
},
acquireWaitCount : {
<mode> : Long("<num>"),
...
},
timeAcquiringMicros : {
<mode> : Long("<num>"),
...
},
deadlockCount : {
<mode> : Long("<num>"),
...
}
},
...
locks

A document that reports for each lock <type>, data on lock <modes>.

The possible lock <types> are:

Lock Type
Description
ParallelBatchWriterMode

Represents a lock for parallel batch writer mode.

In earlier versions, PBWM information was reported as part of the Global lock information.

ReplicationStateTransition
Represents lock taken for replica set member state transitions.
Global
Represents global lock.
Database
Represents database lock.
Collection
Represents collection lock.
Mutex
Represents mutex.
Metadata
Represents metadata lock.
DDLDatabase

Represents a DDL database lock.

New in version 7.1.

DDLCollection

Represents a DDL collection lock.

New in version 7.1.

oplog
Represents lock on the oplog.

The possible <modes> are:

Lock Mode
Description
R
Represents Shared (S) lock.
W
Represents Exclusive (X) lock.
r
Represents Intent Shared (IS) lock.
w
Represents Intent Exclusive (IX) lock.

All values are of the Long() type.

locks.<type>.acquireCount

Number of times the lock was acquired in the specified mode.

locks.<type>.acquireWaitCount

Number of times the locks.<type>.acquireCount lock acquisitions encountered waits because the locks were held in a conflicting mode.

locks.<type>.timeAcquiringMicros

Cumulative wait time in microseconds for the lock acquisitions.

locks.<type>.timeAcquiringMicros divided by locks.<type>.acquireWaitCount gives an approximate average wait time for the particular lock mode.

locks.<type>.deadlockCount

Number of times the lock acquisitions encountered deadlocks.

logicalSessionRecordCache : {
activeSessionsCount : <num>,
sessionsCollectionJobCount : <num>,
lastSessionsCollectionJobDurationMillis : <num>,
lastSessionsCollectionJobTimestamp : <Date>,
lastSessionsCollectionJobEntriesRefreshed : <num>,
lastSessionsCollectionJobEntriesEnded : <num>,
lastSessionsCollectionJobCursorsClosed : <num>,
transactionReaperJobCount : <num>,
lastTransactionReaperJobDurationMillis : <num>,
lastTransactionReaperJobTimestamp : <Date>,
lastTransactionReaperJobEntriesCleanedUp : <num>,
sessionCatalogSize : <num>
},
logicalSessionRecordCache

Provides metrics around the caching of server sessions.

logicalSessionRecordCache.activeSessionsCount

The number of all active local sessions cached in memory by the mongod or mongos instance since the last refresh period.

logicalSessionRecordCache.sessionsCollectionJobCount

The number that tracks the number of times the refresh process has run on the config.system.sessions collection.

logicalSessionRecordCache.lastSessionsCollectionJobDurationMillis

The length in milliseconds of the last refresh.

logicalSessionRecordCache.lastSessionsCollectionJobTimestamp

The time at which the last refresh occurred.

logicalSessionRecordCache.lastSessionsCollectionJobEntriesRefreshed

The number of sessions that were refreshed during the last refresh.

logicalSessionRecordCache.lastSessionsCollectionJobEntriesEnded

The number of sessions that ended during the last refresh.

logicalSessionRecordCache.lastSessionsCollectionJobCursorsClosed

The number of cursors that were closed during the last config.system.sessions collection refresh.

logicalSessionRecordCache.transactionReaperJobCount

The number that tracks the number of times the transaction record cleanup process has run on the config.transactions collection.

logicalSessionRecordCache.lastTransactionReaperJobDurationMillis

The length (in milliseconds) of the last transaction record cleanup.

logicalSessionRecordCache.lastTransactionReaperJobTimestamp

The time of the last transaction record cleanup.

logicalSessionRecordCache.lastTransactionReaperJobEntriesCleanedUp

The number of entries in the config.transactions collection that were deleted during the last transaction record cleanup.

logicalSessionRecordCache.sessionCatalogSize
  • For a mongod instance,
    The size of its in-memory cache of the config.transactions entries. This corresponds to retryable writes or transactions whose sessions have not expired within the localLogicalSessionTimeoutMinutes.
  • For a mongos instance,
    The number of the in-memory cache of its sessions that have had transactions within the most recent localLogicalSessionTimeoutMinutes interval.
mem : {
bits : <int>,
resident : <int>,
virtual : <int>,
supported : <boolean>
},
mem

A document that reports on the system architecture of the mongod and current memory use.

mem.bits

A number, either 64 or 32, that indicates whether the MongoDB instance is compiled for 64-bit or 32-bit architecture.

mem.resident

The value of mem.resident is roughly equivalent to the amount of RAM, in mebibyte (MiB), currently used by the database process. During normal use, this value tends to grow. In dedicated database servers, this number tends to approach the total amount of system memory.

mem.virtual

mem.virtual displays the quantity, in mebibyte (MiB), of virtual memory used by the mongod process.

mem.supported

A boolean that indicates whether the underlying system supports extended memory information. If this value is false and the system does not support extended memory information, then other mem values may not be accessible to the database server.

mem.note

The field mem.note appears if mem.supported is false.

The mem.note field contains the text: 'not all mem info support on this platform'.

metrics : {
abortExpiredTransactions: {
passes: <integer>
},
apiVersions: {
<appName1>: <string>,
<appName2>: <string>,
<appName3>: <string>
},
aggStageCounters : {
<aggregation stage> : Long("<num>")
},
changeStreams: {
largeEventsFailed: Long("<num>"),
largeEventsSplit: Long("<num>"),
showExpandedEvents: Long("<num>")
},
commands: {
<command>: {
failed: Long("<num>"),
validator: {
total: Long("<num>"),
failed: Long("<num>"),
jsonSchema: Long("<num>")
},
total: Long("<num>"),
rejected: Long("<num>")
}
},
cursor : {
moreThanOneBatch : Long("<num>"),
timedOut : Long("<num>"),
totalOpened : Long("<num>"),
lifespan : {
greaterThanOrEqual10Minutes : Long("<num>"),
lessThan10Minutes : Long("<num>"),
lessThan15Seconds : Long("<num>"),
lessThan1Minute : Long("<num>"),
lessThan1Second : Long("<num>"),
lessThan30Seconds : Long("<num>"),
lessThan5Seconds : Long("<num>")
},
open : {
noTimeout : Long("<num>"),
pinned : Long("<num>"),
multiTarget : Long("<num>"),
singleTarget : Long("<num>"),
total : Long("<num>")
}
},
document : {
deleted : Long("<num>"),
inserted : Long("<num>"),
returned : Long("<num>"),
updated : Long("<num>")
},
dotsAndDollarsFields : {
inserts : Long("<num>"),
updates : Long("<num>")
},
getLastError : {
wtime : {
num : <num>,
totalMillis : <num>
},
wtimeouts : Long("<num>"),
default : {
unsatisfiable : Long("<num>"),
wtimeouts : Long("<num>")
}
},
mongos : {
cursor : {
moreThanOneBatch : Long("<num>"),
totalOpened : Long("<num>")
}
},
network : { // Added in MongoDB 6.3
totalEgressConnectionEstablishmentTimeMillis : Long("<num>"),
totalIngressTLSConnections : Long("<num>"),
totalIngressTLSHandshakeTimeMillis : Long("<num>"),
totalTimeForEgressConnectionAcquiredToWireMicros : Long("<num>"),
totalTimeToFirstNonAuthCommandMillis : Long("<num>")
},
operation : {
killedDueToClientDisconnect : Long("<num>"), // Added in MongoDB 7.1
killedDueToDefaultMaxTimeMSExpired : Long("<num>"),
killedDueToMaxTimeMSExpired : Long("<num>"), // Added in MongoDB 7.2
numConnectionNetworkTimeouts : Long("<num>"), // Added in MongoDB 6.3
scanAndOrder : Long("<num>"),
totalTimeWaitingBeforeConnectionTimeoutMillis : Long("<num>"), // Added in MongoDB 6.3
unsendableCompletedResponses : Long("<num>"), // Added in MongoDB 7.1
writeConflicts : Long("<num>")
},
operatorCounters : {
expressions : {
<command> : Long("<num>")
},
match : {
<command> : Long("<num>")
}
},
query: {
allowDiskUseFalse: Long("<num>"),
updateOneOpStyleBroadcastWithExactIDCount: Long("<num>"),
lookup: {
hashLookup: Long("<num>"),
hashLookupSpillToDisk: Long("<num>"),
indexedLoopJoin: Long("<num>"),
nestedLoopJoin: Long("<num>")
},
multiPlanner: {
classicCount: Long("<num>"),
classicMicros: Long("<num>"),
classicWorks: Long("<num>"),
sbeCount: Long("<num>"),
sbeMicros: Long("<num>"),
sbeNumReads: Long("<num>"),
histograms: {
classicMicros: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("1073741824"), count: Long("<num>")> }>
],
classicNumPlans: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("32"), count: Long("<num>") }
],
classicWorks: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("32768"), count: Long("<num>") }
],
sbeMicros: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("1073741824"), count: Long("<num>") }
],
sbeNumPlans: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("32"), count: Long("<num>") }
],
sbeNumReads: [
{ lowerBound: Long("0"), count: Long("<num>") },
{ < Additional histogram groups not shown. > },
{ lowerBound: Long("32768"), count: Long("<num>") }
]
}
},
planCache: {
classic: { hits: Long("<num>"), misses: Long("<num>") },
sbe: { hits: Long("<num>"), misses: Long("<num>") }
},
queryFramework: {
aggregate: {
classicHybrid: Long("<num>"),
classicOnly: Long("<num>"),
cqf: Long("<num>"),
sbeHybrid: Long("<num>"),
sbeOnly: Long("<num>")
},
find: { classic: Long("<num>"), cqf: Long("<num>"), sbe: Long("<num>") }
}
},
queryExecutor: {
scanned : Long("<num>"),
scannedObjects : Long("<num>"),
collectionScans : {
nonTailable : Long("<num>"),
total : Long("<num>")
}
},
record : {
moves : Long("<num>")
},
repl : {
executor : {
pool : {
inProgressCount : <num>
},
queues : {
networkInProgress : <num>,
sleepers : <num>
},
unsignaledEvents : <num>,
shuttingDown : <boolean>,
networkInterface : <string>
},
apply : {
attemptsToBecomeSecondary : Long("<num>"),
batchSize: <num>,
batches : {
num : <num>,
totalMillis : <num>
},
ops : Long("<num>")
},
write : {
batchSize: <num>,
batches : {
num : <num>,
totalMillis : <num>
}
},
buffer : {
write: {
count : Long("<num>"),
maxSizeBytes : Long("<num>"),
sizeBytes : Long("<num>")
},
apply: {
count : Long("<num>"),
sizeBytes : Long("<num>"),
maxSizeBytes : Long("<num>"),
maxCount: Long("<num>")
},
},
initialSync : {
completed : Long("<num>"),
failedAttempts : Long("<num>"),
failures : Long("<num>")
},
network : {
bytes : Long("<num>"),
getmores : {
num : <num>,
totalMillis : <num>
},
notPrimaryLegacyUnacknowledgedWrites : Long("<num>"),
notPrimaryUnacknowledgedWrites : Long("<num>"),
oplogGetMoresProcessed : {
num : <num>,
totalMillis : <num>
},
ops : Long("<num>"),
readersCreated : Long("<num>"),
replSetUpdatePosition : {
num : Long("<num>")
}
},
reconfig : {
numAutoReconfigsForRemovalOfNewlyAddedFields : Long("<num>")
},
stateTransition : {
lastStateTransition : <string>,
totalOperationsKilled : Long("<num>"),
totalOperationsRunning : Long("<num>")
},
syncSource : {
numSelections : Long("<num>"),
numTimesChoseSame : Long("<num>"),
numTimesChoseDifferent : Long("<num>"),
numTimesCouldNotFind : Long("<num>")
},
waiters : {
opTime : Long("<num>"),
replication : Long("<num>")
}
},
storage : {
freelist : {
search : {
bucketExhausted : <num>,
requests : <num>,
scanned : <num>
}
}
},
ttl : {
deletedDocuments : Long("<num>"),
passes : Long("<num>"),
subPasses : Long("<num>")
}
}
metrics

A document that returns various statistics that reflect the current use and state of a running mongod instance.

metrics.abortExpiredTransactions

Document that returns statistics on the current state of the abortExpiredTransactions thread.

metrics.abortExpiredTransactions.passes

Indicates the number of successful passes aborting transactions older than the transactionLifetimeLimitSeconds parameter.

If the passes value stops incrementing, it indicates that the abortExpiredTransactions thread may be stuck.

metrics.aggStageCounters

A document that reports on the use of aggregation pipeline stages. The fields in metrics.aggStageCounters are the names of aggregation pipeline stages. For each pipeline stage, serverStatus reports the number of times that stage has been executed.

Updated in version 5.2 (and 5.0.6).

metrics.apiVersions

A document that contains:

  • The name of each client application

  • The Stable API version that each application was configured with within the last 24-hour period

Consider the following when viewing metrics.apiVersions:

  • The possible returned values for each appname are:

    • default: The command was issued without a Stable API version specified.

    • 1: The command was issued with Stable API version 1.

    Note

    You may see both return values for an appname because you can specify a Stable API version at the command level. Some of your commands may have been issued with no Stable API version, while others were issued with version 1.

  • API version metrics are retained for 24 hours. If no commands are issued with a specific API version from an application in the past 24 hours, that appname and API version will be removed from the metrics. This also applies to the default API version metric.

  • Set the appname when connecting to a MongoDB instance by specifying the appname in the connection URI. ?appName=ZZZ sets the appname to ZZZZ.

  • Drivers accessing the Stable API can set a default appname.

  • If no appname is configured, a default value will be automatically populated based on the product. For example, for a MongoDB Compass connection with no appname in the URI, the metric returns: 'MongoDB Compass': [ 'default' ].

New in version 5.0.

metrics.operatorCounters

A document that reports on the use of aggregation pipeline operators and expressions.

metrics.operatorCounters.expressions

A document with a number that indicates how often Expression Operators ran.

To get metrics for a specific operator, such as the greater-than operator ($gt), append the operator to the command:

db.runCommand( { serverStatus: 1 } ).metrics.operatorCounters.expressions.$gt

New in version 5.0.

metrics.operatorCounters.match

A document with a number that indicates how often match expressions ran.

Match expression operators also increment as part of an aggregation pipeline $match stage. If the $match stage uses the $expr operator, the counter for $expr increments, but the component counters do not increment.

Consider the following query:

db.matchCount.aggregate(
[
{ $match:
{ $expr: { $gt: [ "$_id", 0 ] } }
}
]
)

The counter for $expr increments when the query runs. The counter for $gt does not.

metrics.changeStreams.largeEventsSplit

The number of change stream events larger than 16 MB that were split into smaller fragments. Events are only split if you use the $changeStreamSplitLargeEvent pipeline stage.

New in version 7.0: (Also available in 6.0.9)

metrics.changeStreams

A document that reports information about change stream events larger than 16 MB.

New in version 7.0.

metrics.changeStreams.largeEventsFailed

The number of change stream events that caused a BSONObjectTooLarge exception because the event was larger than 16 MB. To prevent the exception, see $changeStreamSplitLargeEvent.

New in version 7.0: (Also available in 6.0.9 and 5.0.19)

metrics.changeStreams.showExpandedEvents

The number of change stream cursors with the showExpandedEvents option set to true.

The counter for showExpandedEvents increments when you:

  • Open a change stream cursor.

  • Run the explain command on a change stream cursor.

New in version 7.1.

metrics.commands

A document that reports on the use of database commands. The fields in metrics.commands are the names of database commands. For each command, the serverStatus reports the total number of executions and the number of failed executions.

metrics.commands includes replSetStepDownWithForce (i.e. the replSetStepDown command with force: true) as well as the overall replSetStepDown. In earlier versions, the command reported only overall replSetStepDown metrics.

metrics.commands.<command>.failed

The number of times <command> failed on this mongod.

metrics.commands.<create or collMod>.validator

For the create and collMod commands, a document that reports on non-empty validator objects passed to the command to specify validation rules or expressions for the collection.

metrics.commands.<create or collMod>.validator.total

The number of times a non-empty validator object was passed as an option to the command on this mongod.

metrics.commands.<create or collMod>.validator.failed

The number of times a call to the command on this mongod failed with a non-empty validator object due to a schema validation error.

metrics.commands.<create or collMod>.validator.jsonSchema

The number of times a validator object with a $jsonSchema was passed as an option to the command on this mongod.

metrics.commands.<command>.total

The number of times <command> executed on this mongod.

metrics.commands.<command>.rejected

The number of times <command> was rejected on this mongod because the command or operation has an associated query setting where the reject field is true.

To set the reject field, use setQuerySettings.

New in version 8.0.

metrics.commands.update.pipeline

The number of times an aggregation pipeline was used to update documents on this mongod. Subtract this value from the total number of updates to get the number of updates made with document syntax.

The pipeline counter is only available for update and findAndModify operations.

metrics.commands.findAndModify.pipeline

The number of times findAndModify() was used in an aggregation pipeline to update documents on this mongod.

The pipeline counter is only available for update and findAndModify operations.

metrics.commands.update.arrayFilters

The number of times an arrayFilter was used to update documents on this mongod.

The arrayFilters counter is only available for update and findAndModify operations.

metrics.commands.findAndModify.arrayFilters

The number of times an arrayFilter was used with findAndModify() to update documents on this mongod.

The arrayFilters counter is only available for update and findAndModify operations.

metrics.document

A document that reflects document access and modification patterns. Compare these values to the data in the opcounters document, which track total number of operations.

metrics.document.deleted

The total number of documents deleted.

metrics.document.inserted

The total number of documents inserted.

metrics.document.returned

The total number of documents returned by queries.

metrics.document.updated

The total number of documents matched for update operations. This value is not necessarily the same as the number of documents modified by updates.

metrics.dotsAndDollarsFields

A document with a number that indicates how often insert or update operations ran using a dollar ($) prefixed name. The value does not report the exact number of operations.

When an upsert operation creates a new document, it is considered to be an insert rather than an update.

New in version 5.0.

metrics.executor

A document that reports on various statistics for the replication executor.

metrics.getLastError

A document that reports on write concern use.

metrics.getLastError.wtime

A document that reports write concern operation counts with a w argument greater than 1.

metrics.getLastError.wtime.num

The total number of operations with a specified write concern (i.e. w) that wait for one or more members of a replica set to acknowledge the write operation (i.e. a w value greater than 1.)

metrics.getLastError.wtime.totalMillis

The total amount of time in milliseconds that the mongod has spent performing write concern operations with a write concern (i.e. w) that waits for one or more members of a replica set to acknowledge the write operation (i.e. a w value greater than 1.)

metrics.getLastError.wtimeouts

The number of times that write concern operations have timed out as a result of the wtimeout threshold. This number increments for both default and non-default write concern specifications.

metrics.getLastError.default

A document that reports on when a default write concern was used (meaning, a non-clientSupplied write concern). The possible origins of a default write concern are:

  • implicitDefault

  • customDefault

  • getLastErrorDefaults

Refer to the following table for information on each possible write concern origin, or provenance:

Provenance
Description
clientSupplied
The write concern was specified in the application.
customDefault
The write concern originated from a custom defined default value. See setDefaultRWConcern.
getLastErrorDefaults
The write concern originated from the replica set's settings.getLastErrorDefaults field.
implicitDefault
The write concern originated from the server in absence of all other write concern specifications.
metrics.getLastError.default.unsatisfiable

Number of times that a non-clientSupplied write concern returned the UnsatisfiableWriteConcern error code.

metrics.getLastError.default.wtimeouts

Number of times a non-clientSupplied write concern timed out.

metrics.mongos

A document that contains metrics about mongos.

metrics.mongos.cursor

A document that contains metrics for cursors used by mongos.

metrics.mongos.cursor.moreThanOneBatch

The total number of cursors that have returned more than one batch since mongos started. Additional batches are retrieved using the getMore command.

New in version 5.0.

metrics.mongos.cursor.totalOpened

The total number of cursors that have been opened since mongos started, including cursors currently open. Differs from metrics.cursor.open.total, which is the number of currently open cursors only.

New in version 5.0.

metrics.network

New in version 6.3.

A document that reports server network metrics.

metrics.network.totalEgressConnectionEstablishmentTimeMillis

New in version 6.3.

The total time in milliseconds to establish server connections.

metrics.network.totalIngressTLSConnections

New in version 6.3.

The total number of incoming connections to the server that use TLS. The number is cumulative and is the total after the server was started.

metrics.network.totalIngressTLSHandshakeTimeMillis

New in version 6.3.

The total time in milliseconds that incoming connections to the server have to wait for the TLS network handshake to complete. The number is cumulative and is the total after the server was started.

metrics.network.totalTimeForEgressConnectionAcquiredToWireMicros

New in version 6.3.

The total time in microseconds that operations wait between acquisition of a server connection and writing the bytes to send to the server over the network. The number is cumulative and is the total after the server was started.

metrics.network.totalTimeToFirstNonAuthCommandMillis

New in version 6.3.

The total time in milliseconds from accepting incoming connections to the server and receiving the first operation that isn't part of the connection authentication handshake. The number is cumulative and is the total after the server was started.

metrics.operation

A document that holds counters for several types of update and query operations that MongoDB handles using special operation types.

metrics.operation.killedDueToClientDisconnect

New in version 7.1.

Total number of operations cancelled before completion because the client disconnected.

metrics.operation.killedDueToDefaultMaxTimeMSExpired

New in version 8.0.

Total number of operations that timed out due to the cluster-level default timeout, defaultMaxTimeMS.

metrics.operation.killedDueToMaxTimeMSExpired

New in version 7.2.

Total number of operations that timed out due to the operation-level timeout, cursor.maxTimeMS().

metrics.operation.numConnectionNetworkTimeouts

New in version 6.3.

Total number of operations that failed because of server connection acquisition time out errors.

metrics.operation.scanAndOrder

The total number of queries that return sorted numbers that cannot perform the sort operation using an index.

metrics.operation.totalTimeWaitingBeforeConnectionTimeoutMillis

New in version 6.3.

Total time in milliseconds that operations waited before failing because of server connection acquisition time out errors.

metrics.operation.unsendableCompletedResponses

New in version 7.1.

Total number of operations that completed server-side but did not send their response to the client because the connection between the client and server failed or disconnected.

metrics.operation.writeConflicts

The total number of queries that encountered write conflicts.

metrics.query.lookup

A document that provides detailed data on the use of the $lookup stage with the slot-based query execution engine. To learn more, see $lookup Optimization.

These metrics are primarily intended for internal use by MongoDB.

New in version 6.1

metrics.query.multiPlanner

Provides detailed query planning data for the slot-based query execution engine and the classic query engine. For more information on the slot-based query execution engine see: Slot-Based Query Execution Engine Pipeline Optimizations.

These metrics are primarily intended for internal use by MongoDB.

New in version 6.0.0 and 5.0.9

metrics.query.sort

A document that holds counters related to sort stages.

New in version 6.2.

metrics.query.sort.spillToDisk

The total number of writes to disk caused by sort stages.

New in version 6.2.

metrics.query.sort.totalBytesSorted

The total amount of sorted data in bytes.

New in version 6.2.

metrics.query.sort.totalKeysSorted

The total number of keys used in sorts.

New in version 6.2.

query.multiPlanner.classicMicros

Aggregates the total number of microseconds spent in the classic multiplanner.

query.multiPlanner.classicWorks

Aggregates the total number of "works" performed in the classic multiplanner.

query.multiPlanner.classicCount

Aggregates the total number of invocations of the classic multiplanner.

query.multiPlanner.sbeMicros

Aggregates the total number of microseconds spent in the slot-based execution engine multiplanner.

query.multiPlanner.sbeNumReads

Aggregates the total number of reads done in the slot-based execution engine multiplanner.

query.multiPlanner.sbeCount

Aggregates the total number of invocations of the slot-based execution engine multiplanner.

query.multiPlanner.histograms.classicMicros

A histogram measuring the number of microseconds spent in an invocation of the classic multiplanner.

query.multiPlanner.histograms.classicWorks

A histogram measuring the number of "works" performed during an invocation of the classic multiplanner.

query.multiPlanner.histograms.classicNumPlans

A histogram measuring the number of plans in the candidate set during an invocation of the classic multiplanner.

query.multiPlanner.histograms.sbeMicros

A histogram measuring the number of microseconds spent in an invocation of the slot-based execution engine multiplanner.

query.multiPlanner.histograms.sbeNumReads

A histogram measuring the number of reads during an invocation of the slot-based execution engine multiplanner.

query.multiPlanner.histograms.sbeNumPlans

A histogram measuring the number of plans in the candidate set during an invocation of the slot-based execution engine multiplanner.

query.queryFramework.aggregate

A document that reports on the number of aggregation operations run on each query framework. The subfields in query.queryFramework.aggregate indicate the number of times each framework was used to perform an aggregation operation.

query.queryFramework.find

A document that reports on the number of find operations run on each query framework. The subfields in query.queryFramework.find indicate the number of times each framework was used to perform a find operation.

metrics.queryExecutor

A document that reports data from the query execution system.

metrics.queryExecutor.scanned

The total number of index items scanned during queries and query-plan evaluation. This counter is the same as totalKeysExamined in the output of explain().

metrics.queryExecutor.scannedObjects

The total number of documents scanned during queries and query-plan evaluation. This counter is the same as totalDocsExamined in the output of explain().

metrics.queryExecutor.collectionScans

A document that reports on the number of queries that performed a collection scan.

metrics.queryExecutor.collectionScans.nonTailable

The number of queries that performed a collection scan that did not use a tailable cursor.

metrics.queryExecutor.collectionScans.total

The total number queries that performed a collection scan. The total consists of queries that did and did not use a tailable cursor.

metrics.record

A document that reports on data related to record allocation in the on-disk memory files.

metrics.repl

A document that reports metrics related to the replication process. metrics.repl document appears on all mongod instances, even those that aren't members of replica sets.

metrics.repl.apply

A document that reports on the application of operations from the replication oplog.

metrics.repl.apply.batchSize

The total number of oplog operations applied. The metrics.repl.apply.batchSize is incremented with the number of operations in a batch at the batch boundaries instead of being incremented by one after each operation.

For finer granularity, see metrics.repl.apply.ops.

metrics.repl.apply.batches

metrics.repl.apply.batches reports on the oplog application process on secondaries members of replica sets. See Multithreaded Replication for more information on the oplog application processes.

metrics.repl.apply.batches.num

The total number of batches applied across all databases.

metrics.repl.apply.batches.totalMillis

The total amount of time in milliseconds the mongod has spent applying operations from the oplog.

metrics.repl.apply.ops

The total number of oplog operations applied. metrics.repl.apply.ops is incremented after each operation.

metrics.repl.write

Document that reports on entries written to the oplog.

New in version 8.0.

metrics.repl.write.batchSize

Total number of entries written to the oplog. This metric updates with the number of entries in each batch as the member finishes writing the batch to the oplog.

New in version 8.0.

metrics.repl.write.batches

Document that reports on the oplog writing process for secondary members.

New in version 8.0.

metrics.repl.write.batches.num

Total number of batches written across all databases.

New in version 8.0.

metrics.repl.write.batches.totalMillis

Total time in milliseconds the member has spent writing entries to the oplog.

New in version 8.0.

metrics.repl.buffer

MongoDB buffers oplog operations from the replication sync source buffer before applying oplog entries in a batch. metrics.repl.buffer provides a way to track oplog buffers. See Multithreaded Replication for more information on the oplog application process.

Changed in version 8.0.

Starting in MongoDB 8.0, secondaries now update the local oplog and apply changes to the database in parallel. For each batch of oplog entries, MongoDB uses two buffers:

  • The write buffer receives new oplog entries from the primary. The writer adds these entries to the local oplog and sends them to the applier.

  • The apply buffer receives new oplog entries from the writer. The applier uses these entries to update the local database.

This is a breaking change as it deprecates the older metrics.repl.buffer status metrics.

metrics.repl.buffer.apply

Provides information on the status of the oplog apply buffer.

New in version 8.0.

metrics.repl.buffer.apply.count

The current number of operations in the oplog apply buffer.

New in version 8.0.

metrics.repl.buffer.apply.maxCount

Maximum number of operations in the oplog apply buffer. mongod sets this value using a constant, which is not configurable.

New in version 8.0.

metrics.repl.buffer.apply.maxSizeBytes

Maximum size of the apply buffer. mongod sets this size using a constant, which is not configurable.

New in version 8.0.

metrics.repl.buffer.apply.sizeBytes

The current size of the contents of the oplog apply buffer.

New in version 8.0.

metrics.repl.buffer.count

Deprecated since version 8.0.

Starting in MongoDB 8.0, secondaries use separate buffers to write and apply oplog entries. For the current number of operations in the oplog buffers, see the apply.count or write.count status metrics.

metrics.repl.buffer.maxSizeBytes

Deprecated since version 8.0.

Starting in MongoDB 8.0, secondaries use separate buffers to write and apply oplog entries. For the maximum size of the buffers, see the apply.maxSizeBytes or write.maxSizeBytes status metrics.

metrics.repl.buffer.sizeBytes

Deprecated since version 8.0.

Starting in MongoDB 8.0, secondaries use separate buffers to write and apply oplog entries. For the current size of the oplog buffers, see the apply.sizeBytes or write.sizeBytes status metrics.

metrics.repl.buffer.write

Provides information on the status of the oplog write buffer.

New in version 8.0.

metrics.repl.buffer.write.count

The current number of operations in the oplog write buffer.

New in version 8.0.

metrics.repl.buffer.write.maxSizeBytes

Maximum size of the write buffer. mongod sets this value using a constant, which is not configurable.

New in version 8.0.

metrics.repl.buffer.write.sizeBytes

The current size of the contents of the oplog write buffer.

New in version 8.0.

metrics.repl.network

metrics.repl.network reports network use by the replication process.

metrics.repl.network.bytes

metrics.repl.network.bytes reports the total amount of data read from the replication sync source.

metrics.repl.network.getmores

metrics.repl.network.getmores reports on the getmore operations, which are requests for additional results from the oplog cursor as part of the oplog replication process.

metrics.repl.network.getmores.num

metrics.repl.network.getmores.num reports the total number of getmore operations, which are operations that request an additional set of operations from the replication sync source.

metrics.repl.network.getmores.totalMillis

metrics.repl.network.getmores.totalMillis reports the total amount of time required to collect data from getmore operations.

Note

This number can be quite large, as MongoDB will wait for more data even if the getmore operation does not initial return data.

metrics.repl.network.getmores.numEmptyBatches

The number of empty oplog batches a secondary receives from its sync source. A secondary receives an empty batch if it is fully synced with its source and either:

  • The getmore times out waiting for more data, or

  • The sync source's majority commit point has advanced since the last batch sent to this secondary.

For a primary, if the instance was previously a secondary, the number reports on the empty batches received when it was a secondary. Otherwise, for a primary, this number is 0.

metrics.repl.network.notPrimaryLegacyUnacknowledgedWrites

The number of unacknowledged (w: 0) legacy write operations (see Opcodes) that failed because the current mongod is not in PRIMARY state.

metrics.repl.network.notPrimaryUnacknowledgedWrites

The number of unacknowledged (w: 0) write operations that failed because the current mongod is not in PRIMARY state.

metrics.repl.network.oplogGetMoresProcessed

A document that reports the number of getMore commands to fetch the oplog that a node processed as a sync source.

metrics.repl.network.oplogGetMoresProcessed.num

The number of getMore commands to fetch the oplog that a node processed as a sync source.

metrics.repl.network.oplogGetMoresProcessed.totalMillis

The time, in milliseconds, that a node spent processing the getMore commands counted in metrics.repl.network.oplogGetMoresProcessed.num.

metrics.repl.network.ops

The total number of operations read from the replication source.

metrics.repl.network.readersCreated

The total number of oplog query processes created. MongoDB will create a new oplog query any time an error occurs in the connection, including a timeout, or a network operation. Furthermore, metrics.repl.network.readersCreated will increment every time MongoDB selects a new source for replication.

metrics.repl.network.replSetUpdatePosition

A document that reports the number of replSetUpdatePosition commands a node sent to its sync source.

metrics.repl.network.replSetUpdatePosition.num

The number of replSetUpdatePosition commands a node sent to its sync source. replSetUpdatePosition commands are internal replication commands that communicate replication progress from nodes to their sync sources.

Note

Replica set members in the STARTUP2 state do not send the replSetUpdatePosition command to their sync source.

metrics.repl.reconfig

A document containing the number of times that member newlyAdded fields were automatically removed by the primary. When a member is first added to the replica set, the member's newlyAdded field is set to true.

New in version 5.0.

metrics.repl.reconfig.numAutoReconfigsForRemovalOfNewlyAddedFields

The number of times that newlyAdded member fields were automatically removed by the primary. When a member is first added to the replica set, the member's newlyAdded field is set to true. After the primary receives the member's heartbeat response indicating the member state is SECONDARY, RECOVERING, or ROLLBACK, the primary automatically removes the member's newlyAdded field. The newlyAdded fields are stored in the local.system.replset collection.

New in version 5.0.

metrics.repl.stateTransition

Information on user operations when the member undergoes one of the following transitions that can stop user operations:

  • The member steps up to become a primary.

  • The member steps down to become a secondary.

  • The member is actively performing a rollback.

metrics.repl.stateTransition.lastStateTransition

The transition being reported:

State Change
Description
"stepUp"
The member steps up to become a primary.
"stepDown"
The member steps down to become a secondary.
"rollback"
The member is actively performing a rollback.
""
The member has not undergone any state changes.
metrics.repl.stateTransition.totalOperationsKilled

The total number of operations stopped during the mongod instance's state change.

New in version 7.3: totalOperationsKilled replaces userOperationsKilled

metrics.repl.stateTransition.totalOperationsRunning

The total number of operations that remained running during the mongod instance's state change.

New in version 7.3: totalOperationsRunning replaces userOperationsRunning

metrics.repl.stateTransition.userOperationsKilled

Deprecated since version 7.3: totalOperationsKilled replaces userOperationsKilled.

metrics.repl.stateTransition.userOperationsRunning

Deprecated since version 7.3: totalOperationsRunning replaces userOperationsRunning.

metrics.repl.syncSource

Information on a replica set node's sync source selection process.

metrics.repl.syncSource.numSelections

Number of times a node attempted to choose a node to sync from among the available sync source options. A node attempts to choose a node to sync from if, for example, the sync source is re-evaluated or the node receives an error from its current sync source.

metrics.repl.syncSource.numTimesChoseSame

Number of times a node kept its original sync source after re-evaluating if its current sync source was optimal.

metrics.repl.syncSource.numTimesChoseDifferent

Number of times a node chose a new sync source after re-evaluating if its current sync source was optimal.

metrics.repl.syncSource.numTimesCouldNotFind

Number of times a node could not find an available sync source when attempting to choose a node to sync from.

metrics.repl.waiters.replication

The number of threads waiting for replicated or journaled write concern acknowledgments.

New in version 7.3.

metrics.repl.waiters.opTime

The number of threads queued for local replication optime assignments.

New in version 7.3.

metrics.storage.freelist.search.bucketExhausted

The number of times that mongod has examined the free list without finding a large record allocation.

metrics.storage.freelist.search.requests

The number of times mongod has searched for available record allocations.

metrics.storage.freelist.search.scanned

The number of available record allocations mongod has searched.

metrics.ttl

A document that reports on the operation of the resource use of the ttl index process.

metrics.ttl.deletedDocuments

The total number of documents deleted from collections with a ttl index.

metrics.ttl.passes

Number of passes performed by the TTL background process to check for expired documents. A pass is complete when the TTL monitor has deleted as many candidate documents as it can find from all TTL indexes. For more information on the TTL index deletion process, see Deletion Process.

metrics.ttl.subPasses

Number of sub-passes performed by the TTL background process to check for expired documents. For more information on the TTL index deletion process, see Deletion Process.

metrics.cursor

A document that contains data regarding cursor state and use.

metrics.cursor.moreThanOneBatch

The total number of cursors that have returned more than one batch since the server process started. Additional batches are retrieved using the getMore command.

New in version 5.0.

metrics.cursor.timedOut

The total number of cursors that have timed out since the server process started. If this number is large or growing at a regular rate, this may indicate an application error.

metrics.cursor.totalOpened

The total number of cursors that have been opened since the server process started, including cursors currently open. Differs from metrics.cursor.open.total, which is the number of currently open cursors only.

New in version 5.0.

metrics.cursor.lifespan

A document that reports the number of cursors that have lifespans within specified time periods. The cursor lifespan is the time period from when the cursor is created to when the cursor is killed using the killCursors command or the cursor has no remaining objects in the batch.

The lifespan time periods are:

  • < 1 second

  • >= 1 second to < 5 seconds

  • >= 5 seconds to < 15 seconds

  • >= 15 seconds to < 30 seconds

  • >= 30 seconds to < 1 minute

  • >= 1 minute to < 10 minutes

  • >= 10 minutes

New in version 5.0.

metrics.cursor.lifespan.greaterThanOrEqual10Minutes

The number of cursors with a lifespan >= 10 minutes.

New in version 5.0.

metrics.cursor.lifespan.lessThan10Minutes

The number of cursors with a lifespan >= 1 minute to < 10 minutes.

New in version 5.0.

metrics.cursor.lifespan.lessThan15Seconds

The number of cursors with a lifespan >= 5 seconds to < 15 seconds.

New in version 5.0.

metrics.cursor.lifespan.lessThan1Minute

The number of cursors with a lifespan >= 30 seconds to < 1 minute.

New in version 5.0.

metrics.cursor.lifespan.lessThan1Second

The number of cursors with a lifespan < 1 second.

New in version 5.0.

metrics.cursor.lifespan.lessThan30Seconds