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 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 Mongo URL (internal) 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 General so the generated URLs and automated backups use current credentials.

Connect to MongoDB

Use the Mongo URL (internal) 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 Mongo URL (public) only after Public access > Access > Public through TCP proxy and Public port are configured. Keep MongoDB private unless an external client requires direct access.

Configure MongoDB

Open General to change the image, root credentials, Port mappings, public proxy, custom Docker options, and Custom MongoDB 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 Healthcheck and restart MongoDB after saving.

Official MongoDB resources

On this page