Create MongoDB Database
curl -X POST "https://your-dokploy-instance.com/api/mongo.create" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production MongoDB",
"appName": "prod-mongo",
"databaseUser": "appuser",
"databasePassword": "SecurePass123!",
"dockerImage": "mongo:15",
"environmentId": "env_123456",
"description": "Main production MongoDB database",
"replicaSets": false
}'
Display name for the MongoDB database
Unique application name used for Docker container identification
Username for database access
Password for database user. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
ID of the environment where this database will be deployed
Docker image to use for MongoDB
Optional description of the database instance
Enable MongoDB replica sets for high availability
Optional server ID for deployment on specific server
Unique identifier for the created MongoDB instance
Application name of the database
Display name of the database
Get MongoDB Database
curl -X GET "https://your-dokploy-instance.com/api/mongo.one?mongoId=mongo_123456" \
-H "Authorization: Bearer YOUR_API_TOKEN"
ID of the MongoDB database to retrieve
Current status: idle, running, done, or error
External port for database access (if configured)
Whether replica sets are enabled
Deploy MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.deploy" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456"
}'
ID of the MongoDB database to deploy
Start MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456"
}'
ID of the MongoDB database to start
Stop MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.stop" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456"
}'
ID of the MongoDB database to stop
Update MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.update" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456",
"name": "Updated MongoDB Database",
"description": "Updated description",
"memoryLimit": "2g",
"memoryReservation": "1g",
"cpuLimit": "1",
"cpuReservation": "0.5"
}'
ID of the MongoDB database to update
Maximum memory (e.g., “2g”, “512m”)
Guaranteed memory allocation
Guaranteed CPU allocation
Save External Port
curl -X POST "https://your-dokploy-instance.com/api/mongo.saveExternalPort" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456",
"externalPort": 27017
}'
ID of the MongoDB database
Port number for external access. Set to null to remove external port.
Save Environment Variables
curl -X POST "https://your-dokploy-instance.com/api/mongo.saveEnvironment" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456",
"env": "MONGO_INITDB_DATABASE=myapp\nMONGO_CUSTOM_CONFIG=value"
}'
ID of the MongoDB database
Environment variables in KEY=VALUE format, separated by newlines
Reload MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.reload" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456",
"appName": "prod-mongo"
}'
ID of the MongoDB database
Application name of the database
Rebuild MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.rebuild" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456"
}'
ID of the MongoDB database to rebuild
Remove MongoDB
curl -X POST "https://your-dokploy-instance.com/api/mongo.remove" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mongoId": "mongo_123456"
}'
ID of the MongoDB database to remove
Standard Connection
mongodb://[databaseUser]:[databasePassword]@[appName]:27017
Example:
mongodb://appuser:SecurePass123!@prod-mongo:27017
With Database Name
mongodb://[databaseUser]:[databasePassword]@[appName]:27017/[databaseName]
External Connection
Replica Set Connection
mongodb://[databaseUser]:[databasePassword]@host1:27017,host2:27017,host3:27017/?replicaSet=myReplicaSet
Mount Path
MongoDB data is stored at /data/db inside the container.