MongoDB Atlas
The MongoDB Atlas destination writes data to MongoDB Atlas and MongoDB Enterprise Server. For information about supported versions, see Supported Systems and Versions.
The MongoDB Atlas destination can write CDC data if an operation is specified in the CRUD operation header attribute. When not specified, it treats all records as inserts. The destination can also perform upserts for update and replace records. For information about Data Collector change data processing and a list of CDC-enabled origins, see Processing Changed Data.
When you configure the destination, you define connection information, such as the connection string and credentials to use. You can specify SSL/TLS properties for an SSL/TLS-enabled MongoDB Atlas cluster. You can also use a connection to configure the origin.
You configure the database, collection, and write concern to use. To replace and update records, you must specify a unique key field and can optionally enable an upsert flag. When you do not specify a unique key field, update and replace records are sent to the stage for error handling.
You can optionally configure advanced options that determine how the destination connects to MongoDB Atlas.
Credentials
Based on the authentication used by MongoDB, configure the MongoDB Atlas destination to use no authentication, username/password authentication, or LDAP authentication. By default, no authentication is used.
- Authentication method
- Specify the authentication to use with the Authentication Method property on the Credentials tab. Then, you define the username and password for the authentication method.
- Connection string
- Enter credentials in the connection string on the Connection tab.
Specifying Field Paths
- Data Collector format - Uses a slash ( / ) as a delimiter. Includes a leading slash.
- MongoDB format - Uses a period ( . ) as a delimiter.
Data Collector Format | MondoDB Format |
---|---|
/_id | _id |
/orders/address/line1 | orders.address.line1 |
/orders/lines[1]/quantity | orders.lines[1].quantity |
Unordered Writes and Stopping the Pipeline
- ordered writes
- The MongoDB Atlas destination performs ordered writes by default. Use this mode to perform ordered writes for pipelines that handle a range of CRUD operations. When all operations are Inserts, the destination performs ordered writes by default.
- unordered writes
- When ordered writes are not required, you can improve pipeline performance by configuring the MongoDB Atlas destination to perform unordered writes. Use this mode when all records to be processed are Inserts or if the order of the writes is not important. Otherwise data consistency is not guaranteed.
Use the Ordered Writes property on the MongoDB tab to specify the type of writes that the destination performs.
Define the CRUD Operation
To write to MongoDB Atlas, ensure that the CRUD operation record header attribute is defined for each record earlier in the pipeline. Records without an operation record header attribute are sent to error.
To update and replace records, you must specify a unique key field. You can also enable upserts for update and replace records.
Note that when performing a DELETE operation, the destination deletes a maximum of one matching document in MongoDB Atlas. It does not delete all matching documents, as is sometimes possible with MongoDB Atlas.
- sdc.operation.type
- When defined, the MongoDB Atlas destination uses the CRUD operation in the
sdc.operation.type
record header attribute when writing to MongoDB. When not specified, it treats all records as Inserts.
Performing Upserts
You can configure the destination to perform upserts. When you enable upserts, the destination inserts records for Update and Replace records when it does not find an existing record to update or replace.
By default, the destination does not perform upserts. If the destination does not find an existing record for a record flagged for update or replace, it does not write the record to MongoDB Atlas.
For more information about MongoDB Atlas operations and the upsert flag, see the MongoDB Atlas documentation.
Enabling SSL/TLS
- Atlas/System CA - Connects to a MongoDB Atlas cluster. You can also use this when your certificates or keys have already been specified at the JVM level.
- Server Validation (1 Way TLS) - Connects to an SSL/TLS-enabled MongoDB Enterprise Server cluster when the client needs to validate the server certificate and does not need to prove client identity.
- Server and Client Validation (2 Way TLS) - Connects to an SSL/TLS-enabled MongoDB Enterprise Server cluster when the client needs to validate the server certificate and the server also validates the client key. This occurs when the cluster is set up to require client certificates.
- JKS (Java Keystore)
- PEM (text-based)
- DER (text-based)
- PKCS #7 / P7B
- PKCS #12 / P12 / PFX
- Private keys inside PEM, DER, or PKCS #12 encoded as PKCS#1 or PKCS#8
If the files are in PEM or DER plain text format, you can
provide the text in the stage properties. The certificate should begin and end with text
such as: —BEGIN CERTIFICATE—
or —END PRIVATE KEY—
.
Otherwise, you provide a path to the certificate file.
Configuring a MongoDB Atlas Destination
Configure a MongoDB Atlas destination to write to MongoDB Atlas or MongoDB Enterprise Server.