The net configuration file key allows you to adjust network-related settings. Here are some of the core options:
Key | Notes |
port | The port on which the MongoDB server daemon listens. The default is 2017. |
bindIp | You can specify one or more Internet Protocol (IP) addresses as values. Instead of 127.0.0.1, you can also indicate localhost. If you wish to bind to all IP addresses, specify 0.0.0.0. Alternatively, starting with MongoDB 4.2, you can specify "*" (double quotes required). IP addresses can be IPv4 or IPv6. |
bindIpAll | As an alternative to bindIp: 0.0.0.0, you can set a value of true for this key instead. |
ipV6 | Set this parameter to true if you wish to use IPv6 addressing. |
maxIncomingConnections | Set an integer value to limit the number of network connections allowed. The default is 65536. |
Another important networking option is net.tls; however, this is not covered in this chapter, but rather in the next chapter, Chapter 3...