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:

mongodb:
  host: localhost
  port: 27017
  dbname: gigantics
  username: ''
  password: ''

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

mongodb:
  host: localhost
  port: 27017
  dbname: gigantics
  username: ''
  password: ''

Remote MongoDB Connection

mongodb:
  host: mongodb.yourcompany.com
  port: 27017
  dbname: gigantics_prod
  username: 'gigantics_user'
  password: 'secure_password'

MongoDB Atlas Connection

mongodb:
  host: 'mongodb+srv://username:password@cluster0.example.mongodb.net/gigantics'
  port: 27017
  dbname: gigantics
  username: ''
  password: ''

MongoDB with Authentication

mongodb:
  host: localhost
  port: 27017
  dbname: gigantics
  username: 'admin'
  password: 'secure_admin_password'

Connection URI Generation

Gigantics automatically generates the MongoDB connection URI based on your configuration:

  1. If host starts with 'mongodb://', it uses the host as the full URI
  2. If both username and password are provided, it creates a URI with authentication: mongodb://username:password@host:port
  3. Otherwise, it creates a simple URI: mongodb://host:port

Best Practices

  1. Security: Always use authentication in production environments
  2. Backups: Ensure your MongoDB instance has proper backup procedures
  3. Performance: Consider MongoDB performance tuning for large datasets
  4. Network: Ensure the MongoDB server is accessible from the Gigantics server
  5. Version: Use MongoDB version 4.0 or higher as recommended

Testing Configuration Changes

After modifying MongoDB configuration, restart the application:

./gig stop
./gig start

Check the logs for any connection errors. A successful connection will show database initialization messages.

On this page