Administration/Configuration Files
MongoDB Configuration
Configure the MongoDB database connection settings for your Gigantics instance.
Configuration Properties
The MongoDB configuration section in your config/default.yaml file controls how Gigantics connects to the database:
Property Details
host
- Type: String
- Default:
'localhost' - Description: The hostname or IP address of your MongoDB server. Can also be a full MongoDB URI.
port
- Type: Number
- Default:
27017 - Description: The port number MongoDB is listening on.
dbname
- Type: String
- Default:
'gigantics' - Description: The name of the database Gigantics will use to store its data.
username
- Type: String
- Default:
'' - Description: The username for authentication with MongoDB (if required).
password
- Type: String
- Default:
'' - Description: The password for authentication with MongoDB (if required).
Examples
Local MongoDB Connection
Remote MongoDB Connection
MongoDB Atlas Connection
MongoDB with Authentication
Connection URI Generation
Gigantics automatically generates the MongoDB connection URI based on your configuration:
- If
hoststarts with'mongodb://', it uses the host as the full URI - If both
usernameandpasswordare provided, it creates a URI with authentication:mongodb://username:password@host:port - Otherwise, it creates a simple URI:
mongodb://host:port
Best Practices
- Security: Always use authentication in production environments
- Backups: Ensure your MongoDB instance has proper backup procedures
- Performance: Consider MongoDB performance tuning for large datasets
- Network: Ensure the MongoDB server is accessible from the Gigantics server
- Version: Use MongoDB version 4.0 or higher as recommended
Testing Configuration Changes
After modifying MongoDB configuration, restart the application:
Check the logs for any connection errors. A successful connection will show database initialization messages.