Connecting the same MongoDB Atlas database to a local app and a railway deployed app

I have developed a web-app using Express (Node.js/JavaScript) web frameworks, initially following a MDN tutorial but flying solo now. There is an MongoDB Atlas database, for the data, connected to the app and working very well. On deploying the app via Railway, without a database service, I expected to be able to connect to the same Atlas database using the same connection script "mongodb+srv://<username>:<password>". This failed to connect even though I had a white-listed IP (

Many hours of reading and experimenting followed including replacing the Atlas DB with a MongoDB service in the Railway container. Long story short over 24 hours after having added a white-list IP to my Atlas account the app on Railway connected to the Atlas database!! Clearly my problem is resolved but I thought it might be a good discussion topic for my first post on this forum. Thanks for “listening”.

1 Like