MongoDB

Coolify deploys MongoDB as a standalone container on the selected server and destination. A new resource gets a generated root password, a persistent data volume, an internal connection URL, and a health check.

MongoDB is a document database that stores JSON-like documents instead of rows in fixed relational tables.

Create a MongoDB database

Open New Resource

Open the project and environment where the database should live, then select New Resource.

Select MongoDB

Under Databases, select MongoDB. You can also search for MongoDB by name.

Select a server

Select the server that should run MongoDB. Build servers cannot be selected because they do not host running database resources.

Select a destination

Select the Docker network destination that MongoDB should join.

Review the generated configuration

Coolify creates the resource and opens Configuration > General. Review the image, root username, generated password, initial database, SSL settings, and connection URLs. Keep the default private networking unless an external client requires access.

Start MongoDB

Select Start and follow the startup output. Wait until MongoDB is running and healthy, then copy the Internal URL into applications on the same destination network.

Default configuration

SettingDefault or behavior
Internal port27017
Default imagemongo:7
Root usernameroot
Initial databasedefault
Data mounts/data/db and /data/configdb
Scheduled backupsSupported
SSLSupported with MongoDB SSL modes

If you change the root username, password, or initial database inside MongoDB, update the matching values in Configuration > General so the generated URLs and automated backups use current credentials.

Connect to MongoDB

Use the Internal URL for an application on the same Coolify destination network:

mongodb://<username>:<password>@<database-container>:27017/?directConnection=true

Coolify's generated internal URL includes /?directConnection=true after the port. Copy the generated URL when possible instead of rebuilding it manually. SSL adds tls=true and the CA path; verify-full also adds the server certificate path. See Database SSL for those paths.

Coolify shows a Public URL only after Make it publicly available and Public Port are configured. Keep MongoDB private unless an external client requires direct access.

Configure MongoDB

Open Configuration > General to change the image, root credentials, Ports Mappings, public proxy, custom Docker options, and Custom Mongo Configuration. Restart the resource after changing generated container configuration.

Back up MongoDB

Coolify uses mongodump and stores a gzip-compressed archive. An empty Databases To Include field includes all databases and collections.

To exclude collections, use this format:

app:events,logs|analytics

This includes all collections in app except events and logs, and all collections in analytics. Configure the schedule, retention, and S3 copy in Database backups.

The built-in Import Backup form accepts MongoDB archives while the database is running. Follow Restore a database, then verify the restored collections from a controlled client workflow.

SSL and health checks

MongoDB supports allow, prefer, require, and verify-full. verify-full requires the client to trust the Coolify CA certificate. See Database SSL.

Configure the Docker health check under Configuration > Healthcheck and restart MongoDB after saving.

Official MongoDB resources

On this page