Mongodb bind multiple ips

Viewed 1415

I'm using mongodb v4.2.3 for ubuntu, and i'm trying to bind localhost and my public ip, but i get an error every time i reload mongodb afther editing the configuration file.

bind_ip = 127.0.0.1
port = 27017

the error while restarting mongodb:

Job for mongodb.service failed because the control process exited with error code.
See "systemctl status mongodb.service" and "journalctl -xe" for details.
1 Answers

Solved.

bind_ip = 127.0.0.1

For single ip, because it's interpreted as number

bind_ip = "127.0.0.1,xxx.xxx.xxx.xxx"

For multiple ip, because it's interpreted as string

Related