Overview
Tesis Rutas uses MongoDB as its database. You can use either a local MongoDB installation or MongoDB Atlas (cloud-hosted).Option 1: Local MongoDB
Installation
- Ubuntu/Debian
- macOS
- Windows
- Docker
Verify Installation
Configuration
Updatesrc/config/local_config.json:
Option 2: MongoDB Atlas (Cloud)
Create MongoDB Atlas account
- Go to mongodb.com/cloud/atlas
- Sign up for a free account
- Create a new cluster (M0 Free tier is sufficient for development)
Configure network access
- In Atlas dashboard, go to Network Access
- Click Add IP Address
- For development, choose Allow Access from Anywhere (0.0.0.0/0)
Create database user
- Go to Database Access
- Click Add New Database User
- Choose Password authentication
- Set username and password
- Grant Read and Write permissions
Get connection string
- Go to Database → Connect
- Choose Connect your application
- Copy the connection string:
Database Schema
The application uses the following collections:destinos (Destinations)
Stores tourist destinations and points of interest.usuarios (Users)
Stores user accounts and authentication data.admin- Full access (create/edit/delete destinations)editor- Can edit and change destination statusvisitante- Read-only, can save favorites
rutas (Routes)
Stores tourist routes and itineraries.MongoDB Connection
The application uses a singleton pattern for database connections:src/infrastructure/database/mongo_config.py
Database Operations
Using MongoDB Shell
Using Python
Indexes
For optimal performance, create these indexes:Backup and Restore
Export database
Import database
Troubleshooting
Connection timeout
Connection timeout
Local MongoDB:MongoDB Atlas:
- Verify IP whitelist includes your IP
- Check username/password in connection string
- Ensure cluster is not paused
Authentication failed
Authentication failed
Local MongoDB:Update URI:
mongodb://admin:password@localhost:27017/Database not created
Database not created
MongoDB creates databases lazily. The database will appear after inserting the first document:
Port 27017 already in use
Port 27017 already in use
Next Steps
Backend Setup
Learn how to run the FastAPI backend
Frontend Setup
Set up the React frontend with Vite