Database Manual / Reference / Database Commands / Diagnostics

getCmdLineOpts (database command数据库命令)

Definition定义

getCmdLineOpts
The getCmdLineOpts command returns a document containing command line options used to start the given mongod or mongos. Run getCmdLineOpts in the admin database.getCmdLineOpts命令返回一个文档,其中包含用于启动给定mongodmongos的命令行选项。在admin数据库中运行getCmdLineOpts

Compatibility兼容性

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

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

Note

This command is supported in all MongoDB Atlas clusters. 所有MongoDB Atlas集群都支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令

  • 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的源代码可用、免费使用和自我管理版本

Syntax语法

The command has the following syntax:该命令具有以下语法:

db.adminCommand(
{
getCmdLineOpts: 1
}
)

Output输出

This command returns a document with two fields, argv and parsed. The argv field contains an array with each item from the command string used to invoke mongod or mongos. The document in the parsed field includes all runtime options, including those parsed from the command line and those specified in the configuration file, if specified.此命令返回一个包含两个字段argvparsed的文档。argv字段包含一个数组,其中包含用于调用mongodmongos的命令字符串中的每个项。parsed字段中的文档包括所有运行时选项,包括从命令行解析的选项和配置文件中指定的选项(如果指定)。

Consider the following example output of getCmdLineOpts:考虑以下getCmdLineOpts的示例输出:

{
"argv" : [
"/usr/bin/mongod",
"--config",
"/etc/mongod.conf"
],
"parsed" : {
"config" : "/etc/mongod.conf",
"net" : {
"bindIp" : "127.0.0.1",
"port" : 27017
},
"processManagement" : {
"fork" : true
},
"storage" : {
"dbPath" : "/data/db"
},
"systemLog" : {
"destination" : "file",
"logAppend" : true,
"path" : "/var/log/mongodb/mongod.log"
}
},
"ok" : 1
}