Choosing Your MongoDB Deployment
Monk supports multiple MongoDB deployment options - from local development containers to enterprise-grade managed clusters. Choose based on your needs, budget, and scale.Option 1: Self-Hosted (Development & Testing)
Best for: Local development, testing, proof-of-concept How it works: When deploying an app that uses MongoDB, Monk detects it and defaults to self-hosted:- Free (runs on your infrastructure)
- Quick setup (< 1 minute)
- Full control over version and configuration
- Persistent storage automatically configured
Option 2: Cloud-Managed Databases
Best for: Production deployments, simplified operationsDigitalOcean Managed MongoDB (4.4-7.0)
- Automated daily backups (7-day retention)
- Automatic security updates
- High availability options
- Vertical scaling (resize anytime)
Option 3: MongoDB Atlas (Enterprise Features)
MongoDB Atlas offers different tiers for different needs: Free Tier (M0) - 512MB:- Perfect for prototypes and learning
- Shared cluster
- No backup API support
- No credit card required
- Production workloads
- Automated backups with point-in-time restore
- Performance optimization tools
- Advanced security features
- Dedicated resources
- Pay only for what you use
- Automatic scaling
- No capacity planning needed
Before You Start
Your application must already use MongoDB in its code - Monk deploys and configures the database, but your application needs to have MongoDB drivers/ODM integrated. What Monk detects:- MongoDB drivers in your dependencies (mongoose, mongodb, pymongo, etc.)
- MongoDB connection strings in your code
- Database configuration files
Deploying Self-Hosted MongoDB
When Monk Detects MongoDB
During deployment, Monk analyzes your code:- Self-hosted (container)
- Cloud-managed (DigitalOcean)
- MongoDB Atlas
- Creates containerized MongoDB instance
- Generates unique credentials
- Wires connection to your application
- Sets up persistent storage
- Injects connection details as environment variables
- Database host and port
- Username and password
- Database name
- Connection string (MONGODB_URI or DATABASE_URL)
Security
Monk applies security best practices automatically:- ✅ Unique credentials - Each deployment gets unique username/password
- ✅ Network isolation - Database not publicly accessible
- ✅ Internal-only access - Only your application can connect
- ✅ Persistent storage - Data survives container restarts
Customization
Need specific MongoDB configuration?Deploying MongoDB Atlas
Setting Up Credentials
Before deploying to Atlas, you’ll need credentials. See MongoDB Atlas Integration for detailed setup instructions. Quick summary:- Create Organization API Key in Atlas
- Grant permissions: Project Creator, Cluster Manager, User Admin
- Save Public Key (Client ID) and Private Key (Client Secret)
- Note your Organization Name
Deploying
When deploying an app that uses MongoDB, tell Monk you want Atlas:- Your Atlas credentials (if not already configured)
- Which tier you want (M0, M10, M20, M30, Flex)
- Preferred cloud provider and region for the cluster
Choosing Your Tier
For development/testing:What Monk Manages
When deploying to Atlas, Monk:- ✅ Creates Atlas project in your organization
- ✅ Provisions cluster with your specifications
- ✅ Creates database user with appropriate permissions
- ✅ Configures IP whitelist (automatically allows your application)
- ✅ Generates connection string
- ✅ Injects credentials into your application
- Project-level isolation
- Role-based database users (readWrite by default)
- Automatic IP whitelisting for your cluster
- TLS encryption enforced
Backups (M10+ Only)
Dedicated clusters (M10 and above) support backups:M0 free tier does not support backup API. For production data, use M10+
dedicated clusters which include automated daily backups and point-in-time
restore.
Deploying Cloud-Managed MongoDB
DigitalOcean Managed MongoDB
When deploying to DigitalOcean with a MongoDB app:- Your DigitalOcean API token (if not configured)
- MongoDB version (4.4, 5.0, 6.0, 7.0)
- Node count (1, 2, or 3)
- Instance size
- Automated daily backups
- 7-day retention
- Automated security patches
- High availability (with 2+ nodes)
Comparing Deployment Options
Not sure which to choose? Ask Monk:| Use Case | Recommended Option |
|---|---|
| Local development | Self-hosted container |
| Prototype/MVP | Atlas M0 (free tier) |
| Production (simple) | DigitalOcean Managed or Atlas M10 |
| Global distribution | MongoDB Atlas |
| Enterprise features | Atlas M10+ |
Switching Between Deployment Types
From Self-Hosted to Managed
Already deployed with self-hosted MongoDB? Tell Monk you want to switch:- Provisions new MongoDB (Atlas/managed service)
- Updates application configuration with new connection details
- Redeploys application with updated config
Data migration is manual. Monk updates connection configuration but
doesn’t automatically transfer data. You’ll need to: 1. Export from current
MongoDB (mongodump) 2. Import to new MongoDB (mongorestore) 3. Verify data
integrity 4. Switch application over (Monk handles config) 5. Decommission old
database
From One Managed Service to Another
Security Best Practices
Monk automatically applies these security practices across all deployment types:All Deployments
- ✅ Unique credentials - Each deployment gets unique database credentials
- ✅ Network isolation - Database not exposed to public internet
- ✅ Encrypted connections - TLS enabled for data in transit
- ✅ Least privilege - Application users have minimal required permissions
Managed Deployments (Atlas, DO)
- ✅ Automatic IP whitelisting - Monk adds your application’s IP automatically
- ✅ Firewall rules - Provider-managed network security
- ✅ Security patches - Automatic updates managed by provider
- ✅ Encryption at rest - Data encrypted on disk (provider-managed)
MongoDB Atlas Specific
- ✅ Project-level isolation - Each deployment in separate Atlas project
- ✅ Role-based users - Database users created with specific roles (readWrite, not admin)
- ✅ Audit logging - Available on M10+ clusters
- ✅ Network peering - Available for private connectivity (M10+)
- ✅ Customer-managed keys - Encryption key management (M10+)
Verify Security Configuration
Ask Monk to check your MongoDB security:Troubleshooting
Connection Issues
- Credentials are correct
- Network connectivity from application
- Database is running and accepting connections
- Firewall/IP whitelist configuration
Performance Issues
- Slow queries and indexes
- Connection pool saturation
- Resource usage (CPU, memory, disk)
- Network latency
Version Compatibility
Cost Optimization
Check MongoDB Costs
Optimize Spending
Related Documentation
- MongoDB Atlas Integration - Full Atlas reference and API operations
- DigitalOcean Databases - DO managed MongoDB details
- Backup & Restore - Backup operations for all database types
- Working with Databases - General database prompts
- Obtaining Credentials - How to get Atlas and cloud credentials
- Security - How Monk secures your databases

