定义
getCmdLineOptsThe
getCmdLineOptscommand returns a document containing command line options used to start the givenmongodormongos. RungetCmdLineOptsin theadmindatabase.
兼容性
此命令可用于以下环境中托管的部署:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
该命令具有以下语法:
db.adminCommand( { getCmdLineOpts: 1 } )
输出
此命令返回包含两个字段的文档: argv和parsed 。 argv字段包含一个数组,其中包含用于调用mongod或mongos的命令字符串中的每一项。 parsed字段中的文档包含所有运行时选项,包括从命令行解析的选项以及配置文件中指定的选项(如果已指定)。
Consider the following example output of 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 }