Skip to main content

MongoDB (Legacy 3.2-3.4)

This connector supports legacy MongoDB versions 3.2 and 3.4. For MongoDB 3.6 and later, please use the standard MongoDB connector.

Supported Versions and Architectures

  • Versions: MongoDB 3.2, 3.4 (for newer versions, use the standard MongoDB connector)
  • Source architectures: Replica sets, sharded clusters (including secondary node sync)
  • Target architectures: Standalone, replica sets, sharded clusters

Supported Data Types

CategoryData Types
Strings and CodeString, JavaScript, Symbol
Numeric TypesDouble, Int32, Int64, Decimal128
Document and ArrayDocument, Array
Binary and ObjectIdBinary, ObjectId
Boolean TypeBoolean
Date and TimestampDate, Timestamp
Special TypesMin Key, Max Key, Null

Quick Setup Guide

1. Configure Replica Set (for CDC)

Convert standalone instances to single-member replica sets to enable oplog:

rs.initiate()

2. Create Database Users

For source databases:

use admin
db.createUser({
user: "xpipes",
pwd: "your_password",
roles: [
{ role: "read", db: "your_database" },
{ role: "read", db: "local" },
{ role: "read", db: "config" },
{ role: "clusterMonitor", db: "admin" }
]
})

For target databases:

use admin
db.createUser({
user: "xpipes",
pwd: "your_password",
roles: [
{ role: "readWrite", db: "your_database" },
{ role: "clusterMonitor", db: "admin" }
]
})
tip

MongoDB 3.2 requires additional read permissions for the local database.

3. Prepare Sharded Clusters

For sharded deployments:

  1. Stop the balancer: sh.stopBalancer()
  2. Clean orphaned documents: db.runCommand({cleanupOrphaned: "db.collection"})
  3. Create users on each shard's primary node

4. Configure Oplog Size

Ensure oplog can store at least 24 hours of operations:

db.runCommand({replSetResizeOplog: 1, size: 16384}) // 16GB

Connection Options

  • URI mode: Use MongoDB connection string format
  • Standard mode: Configure individual connection parameters
  • TLS/SSL: Optional encrypted connections for secure environments

Limitations

  • Version constraint: Only supports MongoDB 3.2 and 3.4
  • Sharded cluster prep: Requires balancer shutdown and orphan cleanup
  • User management: Sharded clusters need users on each shard
  • Oplog dependency: Incremental sync requires replica set configuration