Although Galaxy provides a free MongoDB service, it is not suitable for production usage. Because of that, we advise you to host one yourself. We recommend using a dedicated database hosting service such as ScaleGrid or MongoDB Atlas.
To configure MongoDB for your Meteor application, see the detailed steps in the Deployment guide.
For optimum performance, please ensure your database is running in the same region.
Configuring the app settings file
MongoDB is configured using environment variables in your
settings.json file. Refer to the environment variables section to find a complete example.
Note that a valid
MONGO_URL is required unless you have removed the
mongo package from your app. A missing/invalid
MONGO_URL is a common cause of failed deployments.
Connecting to your database
Galaxy is agnostic about how you talk to MongoDB, as long as you provide the appropriate credentials. If you can’t connect, follow these steps:
- Review the settings and examples on the Environment variables section.
- Try connecting without a Mongo Oplog URL to see if that is causing the issue.
- Verify the URL and username/password by connecting through a MongoDB tool or CLI.
Configuring Oplog Tailing
Meteor can get real time updates from MongoDB by using oplog tailing. Oplog tailing involves reading the MongoDB ‘operations log’ - a special Mongo collection that records all the write operations as they are applied to your database.
To use Oplog tailing, the database must be a Replica set enabled database. Refer to the environment variables section to find an example.