Question

How to connect a MongoDB Database to the App Platform?

I am trying to find the best way to connect to MongoDB when using the App Platform. I didn’t realize at first that it didn’t have a static IP so I looked around. Digital Ocean has Managed Databases so I went to check that out and chose MongoDB, but my App doesn’t show in the lost of Trusted Sources, only droplets. It says App right in the description “Search for Droplets, Kubernetes clusters, Apps and tags, or enter a specific IP”, although they are not supported. So I went to the Apps settings and tried to add a Managed Database as a component and only PostgreSQL is available, which is one of the 4 they support on the regular Managed Databases. I need MongoDB. It is seeming like I need to make droplets for my app and server just to connect to MongoDB. Why do they make this so hard? No static IP, and no way to add an App as a trusted source within the same platform? What should I do here, find a different service? The App Platform having everything in one place is amazing, I wish it would work.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, for reference the documentation for managing databases is here.

So I went to the Apps settings and tried to add a Managed Database as a component and only PostgreSQL is available

So what you saw is likely dev databases, in which PostgreSQL is the only available engine. All managed databases at DigitalOcean are available for use with App Platform.

In the App Platform “Configure your Database” or “Add a Database” screens, there should be an option for “Previously Created DigitalOcean Database”.

If you wanted to create a MongoDB database for your app, you would need to first create a databases at cloud.digitalocean.com/databases (or via the api), or use one that you already created, and then use that in the Previously Created Databases pane.

Trusted sources for MongoDB with App Platform started being supported very recently, you should be able to add your app as a trusted source in the MongoDB settings page at cloud.digitalocean.com/databases.