MongoDB
MongoDB setup, MONGO_ reference variables, multi-port Expose, and dashboard actions.
Written By Zoro
Last updated 28 days ago
MongoDB stores data as documents (similar to JSON).
Itβs a strong fit when your schema evolves often or you work heavily with nested structures.
Overview of databases in dFlow: Databases overview
On this page
- When MongoDB is a good fit
- Create and deploy
- Overview credentials
- Reference variables (
MONGO_β¦) - Expose (multiple public ports)
- Managing the service
When to choose MongoDB
Pick MongoDB when a document model fits your product better than rigid SQL tables, or your stack already uses MongoDB drivers and patterns.
Set up MongoDB in dFlow
- Applications β Environment β Add New β Add service β Database β MongoDB.
- Create Service β Deploy on the new service.
- Wait until Deploy completes; dFlow handles server setup for you.
Your connection details
After a successful deploy, Internal credentials include:
- A connection URL (
mongodb://β¦). - Username, password, hostname, port, and database name broken out for tools that need them.
Use the internal URL for apps in the same environment.
Link your app with reference variables
On an app or Docker service, open the Variables tab and use { } Reference variables. Example:
{{ my-mongo.MONGO_URI }}Internet access (Expose)
MongoDB is a bit different from Postgres or MySQL: when you Expose, dFlow may open more than one public port on the server. You still use the same Expose button; Overview shows the public URL, host, and port information you need.
Tip: Keep using internal URLs for your apps on dFlow. Use Expose when something outside the environment must connect (backup tools, local scripts, partners).
Unexpose before Stop if the database was exposed.
Day-to-day management
Restart, Stop, and Expose / Unexpose follow the same dashboard rules as other databases (including Unexpose before Stop when public, and no Deploy button after the first successful provision). See Where things live in the dashboard.