Starting in MongoDB 4.2, mongod
and mongos
accept --outputConfig
command-line option to output the configuration used by the mongod
/mongos
instance.
You can use this option to convert command-line options to YAML configuration.
mongod
Command-Line Options to YAML¶Consider the following mongod
invocation that uses the command-line options:
Include the --outputConfig
command-line option to generate the corresponding YAML file.
The mongod
outputs the following YAML to stdout
and exits:
To create a configuration file, copy the generated content into a file and delete the outputConfig
setting from the YAML.
mongos
Command-Line Options to YAML¶Consider the following mongos
invocation that uses the command-line options:
Include the --outputConfig
command-line option to generate the corresponding YAML for the mongos
instance:
The mongos
outputs the following YAML to stdout
and exits:
To create a configuration file, copy the generated content into a file and delete the outputConfig
setting from the YAML.