- Reference >
- Configuration File Options >
- Convert Command-Line Options to YAML
Convert Command-Line Options to YAML¶
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.
Examples¶
Convert 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.
Convert 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.