Overview
DevAurva uses MongoDB with Mongoose ODM for data persistence. The application stores custom plan requests and card plan submissions in MongoDB collections.Database Dependencies
The following packages are used for database operations:- mongoose (v8.9.6) - MongoDB object modeling for Node.js
- mongodb (v6.13.0) - Official MongoDB driver
MongoDB Connection Setup
The MongoDB connection is established inserver.js:12-15 using Mongoose:
Setting Up MongoDB
Allowing access from anywhere (0.0.0.0/0) is convenient for development but not recommended for production. Always restrict access to specific IP addresses in production environments.
MONGODB_URI=mongodb+srv://username:[email protected]/devaurva?retryWrites=true&w=majority
Database Models
DevAurva uses two primary MongoDB models:CustomPlan Model
Stores custom website plan requests with selected features (server.js:6):
- Client name, email, phone
- Company name
- Selected features with pricing
- Website type
- Total price
- Additional notes
CardPlan Model
Stores predefined plan selections (server.js:7):
- Client name, email, phone
- Website type
- Plan type (Starter/Professional/Enterprise)
- Plan price
- Budget information
Connection Configuration
The application uses default Mongoose connection settings with:- retryWrites=true - Automatic retry for write operations
- w=majority - Write concern ensuring data is written to majority of nodes
Testing the Database Connection
Troubleshooting
Connection Errors
If you seeMongoDB connection error in the console:
- Verify your
MONGODB_URIis correctly formatted - Check that your IP address is whitelisted in Atlas
- Ensure your database user credentials are correct
- Verify your cluster is active and not paused
Authentication Failed
If authentication fails:- Double-check your username and password in the connection string
- Ensure special characters in passwords are URL-encoded
- Verify the database user has proper permissions
Network Timeout
If you experience timeout issues:- Check your network connectivity
- Verify firewall settings aren’t blocking MongoDB connections
- Ensure your IP is whitelisted in Atlas Network Access
Next Steps
- Set up email notifications
- Configure additional database indexes for performance
- Set up database backup strategies
- Monitor database usage and optimize queries