Galaxy

MongoDB

Document-based database with flexible structure. Perfect for rapid development and evolving data models.

MongoDB on Galaxy

MongoDB is a document database that stores data as JSON-like documents. Unlike traditional databases with fixed tables, MongoDB lets you store whatever structure you need, and change it as your app evolves. It's the go-to choice for developers who want flexibility without fighting their database.

Perfect for Rapid Development

No rigid schemas. No migration headaches. Just store your data and iterate fast.


When to Use MongoDB

Choose MongoDB if your data structure might change frequently, or if you're prototyping and don't want to deal with database migrations yet. It's great for startups, rapid iteration, and content-heavy applications where flexibility matters more than strict relational integrity.

Not Sure Which Database?

MongoDB is more flexible, PostgreSQL is more structured. Both work great on Galaxy. Start with MongoDB if you're experimenting, PostgreSQL if you need strict data relationships.

Free MongoDB Available

Galaxy offers a free MongoDB tier perfect for development and learning. Free databases have usage limits to ensure fair access for everyone. Learn about storage limits and when to upgrade in our Fair Usage Policy for Free MongoDB.


Create a MongoDB Database

Getting a MongoDB database running takes about two minutes.

Open Your Dashboard

Go to your Galaxy dashboard and click Databases in the sidebar.

Start Database Creation

Click Create Database and select MongoDB as your database type.

Configure Your Instance

Choose your MongoDB version and instance size. Pick the region closest to your app for best performance.

Create and Wait

Click Create Database & Start Billing. Galaxy provisions your database in a few minutes. You'll see "Running" when it's ready.

Same Region = Best Performance

Deploy your database in the same region as your app. This minimizes latency and keeps your data transfer free.


Connect to Your App

Click your database in the dashboard to see the connection string. Copy it and add it as an environment variable in your app's settings.

The exact variable name depends on your framework:

  • Meteor apps: Use MONGO_URL
  • Node.js apps: Typically MONGODB_URL or DATABASE_URL
  • Other frameworks: Check your framework's documentation for the expected variable name

Keep Your Connection String Secure

Never hardcode your connection string in your code. Always use environment variables so it stays secure and out of version control.


Features

MongoDB on Galaxy comes with everything you need for production:

Flexible Documents: Add whatever fields you need without migrations. Your schema evolves with your app, not against it.

Automatic Backups: Daily backups included with all plans. Your data is protected without you lifting a finger.

Replica Sets Available: High availability option for production apps. Your data is replicated across multiple nodes, so if one goes down, others keep running.

Zero Transfer Fees: Data moving between your Galaxy app and database is free. No surprise charges on your bill.


Common Questions


What's Next?