Database Manual / Reference / mongosh Methods / Databases

db.hostInfo() (mongosh method方法)

db.hostInfo()

Returns a document with information about the underlying system that the mongod or mongos runs on. Some of the returned fields are only included on some platforms.返回一个文档,其中包含有关mongodmongos运行的底层系统的信息。一些返回的字段仅包含在某些平台上。

db.hostInfo() provides a mongosh helper method around the hostInfo command. The output of db.hostInfo() on a Linux system will resemble the following:db.hostInfo()hostInfo命令周围提供了一个mongosh辅助方法。Linux系统上dbhostInfo()的输出类似于以下内容:

{
"system" : {
"currentTime" : ISODate("<timestamp>"),
"hostname" : "<hostname>",
"cpuAddrSize" : <number>,
"memSizeMB" : <number>,
"memLimitMB" : <number>,
"numCores" : <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>
}

See hostInfo for full documentation of the output of db.hostInfo().有关hostInfo输出的完整文档,请参阅db.hostInfo()

Compatibility兼容性

This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Important

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本