2.7 KiB
2.7 KiB
MongoDB Atlas Setup Guide
Quick Setup (5 minutes)
1. Create Free MongoDB Atlas Account
- Go to: https://www.mongodb.com/cloud/atlas/register
- Sign up with email or Google account
- Choose FREE M0 cluster (512MB storage, perfect for this app)
2. Create Database Cluster
- After login, click "Build a Database"
- Choose M0 FREE tier
- Select AWS provider and closest region (e.g., US East)
- Click "Create Cluster" (takes 1-3 minutes)
3. Configure Database Access
- Click "Database Access" in left sidebar
- Click "Add New Database User"
- Username:
church_admin(or your choice) - Password: Click "Autogenerate Secure Password" and COPY IT
- Database User Privileges: Atlas admin
- Username:
- Click "Add User"
4. Configure Network Access
- Click "Network Access" in left sidebar
- Click "Add IP Address"
- Click "Allow Access from Anywhere" (0.0.0.0/0)
- This allows your PC, mobile, and tablet to connect
- Click "Confirm"
5. Get Connection String
-
Click "Database" in left sidebar
-
Click "Connect" button on your cluster
-
Choose "Connect your application"
-
Copy the connection string (looks like):
mongodb+srv://church_admin:<password>@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority -
Replace
<password>with the password you copied in step 3
6. Update Backend Configuration
Edit backend/.env file:
MONGODB_URI=mongodb+srv://church_admin:YOUR_PASSWORD_HERE@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority
MONGODB_DATABASE=church_songlyric
7. Run Migration
cd backend
.\venv\Scripts\python.exe migrate_to_mongodb.py
Verify Setup
After migration, you can view your data:
- Go to MongoDB Atlas dashboard
- Click "Browse Collections"
- You should see:
songscollection (39 documents)profilescollection (5 documents)profile_songscollection (5 documents)
Connection Benefits
✅ Cross-Device Access: PC, mobile, tablet all connect to same cloud database ✅ Always Online: No need to keep PC running ✅ Automatic Backups: Atlas handles backups ✅ Free Forever: M0 tier is permanently free (512MB) ✅ Secure: Encrypted connections, user authentication
Troubleshooting
Connection timeout?
- Check Network Access allows 0.0.0.0/0
- Verify connection string has correct password
- Check internet connection
Authentication failed?
- Double-check password (no < > brackets)
- Verify username matches database user
Need help?
- MongoDB Atlas docs: https://docs.atlas.mongodb.com/
- Contact support through Atlas dashboard