MongoDB - Oplog user Setup
Guide to setting up oplog tailing for MongoDB databases in Galaxy Database, enabling real-time data synchronization and integration with third-party tools.
Overview
Connect your MongoDB deployments to third-party tools by setting up oplog tailing to read events from the MongoDB oplog. The oplog (operations log) is a special capped collection that keeps a rolling record of all operations modifying the database data. Oplog tailing is particularly beneficial for Meteor apps, ensuring real-time data synchronization.
Oplog Functionality
Oplog functionality in Galaxy Database is available exclusively for replicaset implementations. This feature allows operations to be replicated and integrated with third-party tools, providing real-time notifications for database changes.
Creating a MongoDB User for Oplog Tailing
Once your MongoDB cluster is set up, create a new user for oplog tailing. Connect to your MongoDB database using a management tool (such as Mongo Shell) to set up the oplog account. This gives you administrative access to create the necessary user credentials directly in your database. To do this:
- Use your preferred MongoDB client tool (Mongo Shell, MongoDB Compass, or similar) to connect to your Galaxy-hosted database;
- Authenticate with your existing admin credentials;
- Run the
db.createUser()command with the required permissions:
use admin;
db.createUser({user: "oploguser", pwd: "PasswordForOplog", roles: [{role: "read", db: "local"}]});
For detailed instructions on creating users with the correct permissions, refer to the official MongoDB documentation on db.createUser()"
Connecting to the MongoDB Oplog
To connect to the oplog, ensure your connection string's authSource is set to the admin database where the oplog user is created, pointing to the local database where the oplog resides.
Oplog User Credentials
- Username: oploguser
- Password: PasswordForOplog
Connection String Example
mongodb://oploguser:PasswordForOplog@galaxyhostingdb.meteor.com/local?authSource=admin&replicaSet=replicaSetName
Find your MongoDB Connection String under the Overview tab of your MongoDB cluster details page in the Galaxy Database console.
This documentation provides guidance on setting up oplog tailing for MongoDB databases using Galaxy Database.
Updated on: 23/10/2025