Definition
Compatibility
This command is available in deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
Important
This command is not supported in M0 and Flex clusters. For more information, 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
Syntax
db.adminCommand( { hostInfo: 1 } )
Output
In mongosh you can use db.hostInfo()
as a helper to access hostInfo. The output of
hostInfo on a Linux system will resemble the
following:
{ "system" : { "currentTime" : ISODate("<timestamp>"), "hostname" : "<hostname>", "cpuAddrSize" : <number>, "memSizeMB" : <number>, "memLimitMB" : <number>, "numCores" : <number>, "numCoresAvailableToProcess" : <number>, "cpuArch" : "<identifier>", "numaEnabled" : <boolean> }, "os" : { "type" : "<string>", "name" : "<string>", "version" : "<string>" }, "extra" : { "versionString" : "<string>", "libcVersion" : "<string>", "kernelVersion" : "<string>", "cpuFrequencyMHz" : "<string>", "cpuFeatures" : "<string>", "pageSize" : <number>, "numPages" : <number>, "maxOpenFiles" : <number> }, "ok" : <return> }
Output Fields
hostInfoThe document returned by the
hostInfo.
hostInfo.systemAn embedded document providing information about the underlying environment of the system running the
mongodormongos
hostInfo.system.hostnameThe system name, which should correspond to the output of
hostname -fon Linux systems.
hostInfo.system.memLimitMBThe memory usage limit in megabytes.
For example, running in a container may impose memory limits that are lower than the total system memory. This memory limit, rather than the total system memory, is used as the maximum RAM available to calculate WiredTiger internal cache.
hostInfo.system.numCoresAvailableToProcessThe number of CPU cores available to the process. Returns
-1when the underlying system call to retrieve the number of cores fails.
hostInfo.system.numaEnabledA boolean value.
falseif NUMA is interleaved (i.e. disabled), otherwisetrue.
hostInfo.osAn embedded document that contains information about the operating system running the
mongodandmongos.
hostInfo.extraAn embedded document with extra information about the operating system and the underlying hardware. The content of the
extraembedded document depends on the operating system.
hostInfo.extra.cpuStringA string containing a human-readable description of the system's processor.
cpuStringonly appears on macOS systems.
hostInfo.extra.versionStringA complete string of the operating system version and identification. On Linux and macOS systems, this contains output similar to
uname -a.
hostInfo.extra.libcVersionThe release of the system
libc.libcVersiononly appears on Linux systems.
hostInfo.extra.kernelVersionThe release of the Linux kernel in current use.
kernelVersiononly appears on Linux systems.
hostInfo.extra.alwaysFullSyncalwaysFullSynconly appears on macOS systems.
hostInfo.extra.nfsAsyncnfsAsynconly appears on macOS systems.
hostInfo.extra.cpuFeaturesReports the processor feature flags. On Linux systems this the same information that
/proc/cpuinfoincludes in theflagsfields.
hostInfo.extra.physicalCoresReports the number of physical, non-HyperThreading, cores available on the system.
physicalCoresonly appears on macOS systems.
hostInfo.extra.numPagesnumPagesonly appears on Linux systems.
hostInfo.extra.maxOpenFilesReports the current system limits on open file handles. See UNIX
ulimitSettings for Self-Managed Deployments for more information.maxOpenFilesonly appears on Linux systems.
hostInfo.extra.schedulerReports the active I/O scheduler.
scheduleronly appears on OS X systems.