简体   繁体   中英

Heroku and MongoDB atlas connection

I use Heroku as a server and I use MongoDB Atlas as a database. But since Heroku does not have an IP address, I cannot connect to MongoDB via Heroku. It is said to make the IP address 0.0.0.0 as a platform solution. But MongoDB Atlas no longer accepts this ip address. What solution can I find for this? Thanks for your help in advance.

enter image description here

Actually, MongoDB Atlas supports the IP Address that you are talking about (0.0.0.0).

However, you have a small mistake in your configuration, it should be 0.0.0.0/0 (with the subnet mask).

To configure this, just go to your MongoDB Atlas, click Network Access (in the left sidebar as of the time of this answer was written), then add the IP address of 0.0.0.0/0 . There should also be a setting to Allow Access From Anywhere . You can click it and the result will also be the 0.0.0.0/0 IP address.

Save then wait for MongoDB Atlas to process it. Then, simply connect to your database as usual with the connection string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM