Making a user to tail the oplog with Automation

MongoDB

#Cloud

Update 2/25/2016: The new UI has changed the way this process would look (putting the users & roles under the “More” menu on the Deployment page), but the idea is the same. Feel free to open a ticket or chat us with any questions you may have about this.

A question we are asked a lot is how to create a user that can tail the oplog using Cloud Manager Automation. This is a feature needed by Meteor users if they want to use MongoDB authentication to protect their database servers. Here’s how:

  1. Head to your Authorization & Roles page
    https://webassets.mongodb.com/_com_assets/blog/tblr/40.media.tumblr.com--0200e7a0511418f9d2b9fe4c665f5b20--tumblr_o2p2gpdvMv1sdaytmo1_1280.png
  2. Create a new role (I called mine “oplogger”) that has permissions to read the local database
    https://webassets.mongodb.com/_com_assets/blog/tblr/40.media.tumblr.com--d4c8d81fc0d9efd851746b81cc192148--tumblr_o2p2gpdvMv1sdaytmo3_1280.png
  3. Once you save this role, you can go to your “Authentication & Users” tab:
    https://webassets.mongodb.com/_com_assets/blog/tblr/41.media.tumblr.com--f96e8f97bfd82049079e6fce1fc6dffd--tumblr_o2p2gpdvMv1sdaytmo4_1280.png
  4. Then you can create a user with the “oplogger” role (and any other roles you may want) and save it with a password you know
    https://webassets.mongodb.com/_com_assets/blog/tblr/36.media.tumblr.com--e64047c292c6d67f7a2a1ed5a51f604e--tumblr_o2p2gpdvMv1sdaytmo2_1280.png
  5. Push your changes via “Review & Deploy” and then “Confirm & Deploy”

Once you configure your Meteor installation (MONGO_OPLOG_URL) to connect with the new credentials, your app should work as expected, providing you live tracking of changes.