Skip to main content
MongoDB server must be in a replica set. If your pipeline only has a standalone server, you can create a replica set with one member.Need help? Check out this guide.

Required settings

  • Connection string
  • Service account

Connection string

  1. Go to Atlas UI
  2. Find your pipeline and click “Connect”
We support both MongoDB SRV format or standard connection string.
MongoDB connection string

Service account

You can create a service account through the Atlas UI or by running a script.
  • Click on Database Access on the left
  • Click on Add New Database User
  • Under Database User Privileges, open Built-in Role and Select Only read any database MongoDB Atlas
/* If the user does not exist. */
use admin;
db.createUser({ user: "artie", pwd: "<password>", roles: ["readAnyDatabase", { role: "read", db: "local" }] });

/* If the user already exists */
db.updateUser("artie", { roles: ["readAnyDatabase", { role: "read", db: "local" }] });

Advanced

If you are replicating a MongoDB collection into a partitioned table downstream, you will want to consider enabling this so that the full document before change is available for deletes.This is because we will need the previous row to grab the partitioned field(s) in order to select the right partition downstream.To enable this, you’ll want to run the following commands:
// Enable preAndPostImage on the replica set
use admin;
db.runCommand({
   setClusterParameter: {
      changeStreamOptions: {
         preAndPostImages: {
            expireAfterSeconds: 100
         }
      }
   }
});

// Enable preAndPostImage on the collection
use databaseName;
db.runCommand({ collMod:"collectionName",changeStreamPreAndPostImages: { enabled: true } });

// See the previous setting
db.adminCommand( { getClusterParameter: "changeStreamOptions" } );

// To disable this behavior, you can set expiredAfterSeconds to off
db.runCommand( {
   setClusterParameter:
      { changeStreamOptions: {
         preAndPostImages: { expireAfterSeconds: 'off' }
      } }
} );
I