MongoDB Atlas is a fully managed cloud database service. It allows users to deploy, manage, and scale MongoDB databases in the cloud without the complexities of traditional database management, providing features such as automated backups, monitoring, security, and seamless integration with popular cloud platforms.
Authorize Connection to MongoDB Atlas
Prerequisites
- A running MongoDB Atlas instance reachable by Dataddo. If you use a firewall, allow the Dataddo IPs.
- A database user with rights to create collections and to insert, update, and delete rows in the target schema.
Create the authorizer
In Authorizers, click Authorize New Service and select MongoDB Atlas, then fill in the fields:
| Field | Description |
|---|---|
| A name for this authorizer in Dataddo | A label so you can recognize the connection later. |
| DSN connection string | DSN string can be found in the detail of your MongoDB Atlas cluster as connection string. Make sure to replace the with the value of the database user created in the previous step. |
| Database | Database |
Click Save. Dataddo validates the connection.
Create a MongoDB Atlas Destination
Go to Destinations, click Create Destination, and select MongoDB Atlas. Give the destination a name, choose the authorizer, and click Save.
Write Modes
The write mode decides how each flow run changes the target collection. MongoDB Atlas offers the standard set below, and the default is insert. Which modes are available, and whether you can switch modes on an existing flow, can depend on the collection's current state.
| Mode | Meaning | Composite Key |
|---|---|---|
insert |
Appends new rows on every run. | No |
insert_ignore |
Appends rows, skipping rows that already exist. | Yes |
truncate_insert |
Empties the table, then writes the current data. | No |
upsert |
Inserts new rows and updates existing rows matched by the Composite Key. | Yes |
update |
Updates existing rows matched by the Composite Key; fails rows with no match. | Yes |
update_ignore |
Updates matched rows, skipping rows with no match. | Yes |
delete |
Deletes rows matched by the Composite Key. | Yes |
Composite Key
The Composite Key is the set of columns whose combined values identify each row. Every mode except insert and truncate_insert needs one. You can select up to 4 columns.
Table Naming
Dataddo creates the collection on the first write if it does not exist. When you name the collection:
- Follow MongoDB Atlas's identifier rules for schema and collection names.
How to Create a Flow to MongoDB Atlas
- Go to Flows and click Create Flow.
- Add one or more sources.
- Add MongoDB Atlas as the destination and pick the authorizer.
- Choose a write mode, and a Composite Key for modes that need one.
- Set the schema and the collection name.
- Set the schedule and click Save.
Troubleshooting
Invalid schema or collection name
The schema or collection name does not match MongoDB Atlas's naming rules. Fix the name in the flow to match the rules in Table Naming, then restart the flow.
Insufficient privileges
The database user cannot create collections or write rows in the target schema. Grant the user create, insert, update, and delete rights, then restart the flow.
Cannot connect to MongoDB Atlas
Dataddo cannot reach MongoDB Atlas. Check the credentials in the authorizer, and make sure the server is reachable by Dataddo. If you use a firewall, allow the Dataddo IPs.