Skip to main content

MongoDB Source Connector

The MongoDB source connector lets DataSync retrieve data from a MongoDB instance and load it into your data warehouse. DataSync supports two authentication modes: Basic and NoAuth.

MongoDB stores data as nested documents. The connector can automatically flatten nested objects into separate columns, making them easier to work with in your data warehouse.

Once your source connection is ready, configure your destination connection to finish the setup.

note

The consolidation extraction is not available for MongoDB source connections.

Create the source connection in DataSync

  1. Log in to DataSync.
  2. From the welcome screen, select Connections.
  3. Next to Source Connections, click New.
  4. Select MongoDB.
  5. Enter all required connection properties.
  6. (Optional) In the Additional Connection Properties panel, click Add property and enter any extra parameters you need.
  7. Configure the advanced settings to match your environment, including Tracking Type.
  8. Click Save.

important

MongoDB can store columns that contain arrays of values. When this happens, DataSync may not correctly estimate the column size, which can cause data to be cut off during extraction. To prevent this, set the precision to MAX for those columns in your destination table.

Connection properties

PropertyWhat to enter
DescriptionUnique name for the connection. Example: MongoDB.
ServerServer name or IP address of the MongoDB server. Example: mongodb.example.com
PortPort number for the MongoDB connection. Default: 27017.
DatabaseName of the MongoDB database to connect to. Example: SalesData.
Authentication ModeBasic for username and password authentication stored in the MongoDB database, or NoAuth for connections that require no authentication.
UsernameBasic only Login account stored in the MongoDB database. Example: mongoUser.
PasswordBasic only Password for this account.
Authentication DatabaseBasic only Name of the database used for authentication, if different from the database in the Database field. Example: admin
Flatten ObjectsConverts nested object properties into separate columns. When disabled, nested objects are returned as JSON strings.
Use SSL/TLSSecures the connection using SSL/TLS encryption. Requires a valid SSL certificate.
Allows Invalid Server CertificatesAccepts all certificates from the server when SSL/TLS is enabled. Not recommended as it exposes the connection to security risks.
Row Scan DepthNumber of rows scanned to infer the collection schema. A higher value produces a more accurate schema but may slow down the initial connection. Default: 1000.
VerbosityControls how much detail the connector writes to the log. Each level includes everything from the level below it, plus additional detail.

  • 1 logs queries, row counts, execution start and end times, and errors.
  • 2 adds cache queries and HTTP headers.
  • 3 adds request and response bodies.
  • 4 adds transport-level communication.
  • 5 adds all interface commands.
Enable PoolingEnables connection pooling, which keeps a set of database connections open and reuses them across extractions instead of opening a new connection each time. This reduces overhead and improves performance when multiple extractions run at the same time.
Pool idle timeoutTime in seconds a connection can stay idle before returning to the pool.
Max Pool SizeMaximum number of connections allowed in the pool at the same time.
Pool wait timeTime in seconds DataSync waits for an available connection before throwing an error.

Flatten Objects example

MongoDB stores data as nested documents, meaning a single record can contain objects within objects. When Flatten Objects is enabled, DataSync breaks those nested properties into individual columns, making the data easier to query and analyze in your data warehouse.

Take this sales document as an example. The customer and shipping fields each contain nested properties:

{
"orderId": 10592,
"customer": { "id": 456, "name": "Acme Corp" },
"shipping": { "city": "New York", "state": "NY" }
}

When enabled

With Flatten Objects enabled, each nested property becomes its own column:

orderId 10592
customer.id 456
customer.name Acme Corp
shipping.city New York
shipping.state NY

Additional connection properties

Use this panel to enter connection string properties not available in the Connection Properties panel. For sensitive values such as passwords, set the type to Encrypted. The value is hidden in the interface and stored encrypted in the back end.

PropertyWhat to enter
PropertyConnection string property that defines the action or behavior. Example: ReadOnly
ValueValue for the property. Example: True
TypeVisibility settings: Visible or Encrypted.

Advanced settings

These settings control how the connector tracks data changes, handles time and regional configuration, and processes records during extraction. Configure them to match your MongoDB environment so that results stay accurate and consistent.

SettingWhat to select
Tracking TypeMethod for tracking data changes: None or Date.
RegionRegion setting for the connector, if required by your setup.
Time ZoneTime zone matching your MongoDB environment.
Time OffsetRefresh offset in seconds to compensate for timing issues in record selection. Minimum 0, maximum 3600.
Batch SizeNumber of records processed per batch during extraction. Larger batches can improve performance but use more memory. Default is 2000, maximum is 10000. Adjust based on your network speed and disk performance. The default works well in most cases.

Example setup

MongoDB source connection in DataSync
Completed MongoDB source connection in DataSync with Basic authentication, with all properties and settings filled in.