MongoDB: db.hostInfo() method
db.hostInfo
The db.hostInfo() method is used to return a document with information about the system MongoDB runs on.
Syntax:
db.hostInfo()
{
"system" : {
"currentTime" : ISODate("<timestamp>"),
"hostname" : "<hostname>",
"cpuAddrSize" : <number>,
"memSizeMB" : <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>
}
Example: MongoDB: db.hostInfo() method
db.hostInfo();
Output:
> db.hostInfo(); { "system" : { "currentTime" : ISODate("2016-01-11T11:43:17.824Z"), "hostname" : "myownpc-PC", "cpuAddrSize" : 32, "memSizeMB" : 3487, "numCores" : 2, "cpuArch" : "x86", "numaEnabled" : false }, "os" : { "type" : "Windows", "name" : "Microsoft Windows 7", "version" : "6.1 (build 7600)" }, "extra" : { "pageSize" : NumberLong(4096) }, "ok" : 1 }
Retrieve the restaurants data from here
Previous:
db.help() method
Next:
db.isMaster() method
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mongodb/shell-methods/database/db-hostInfo.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics