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
Category | Data Types |
---|---|
Strings and Code | String, JavaScript, Symbol |
Numeric Types | Double, Int32, Int64, Decimal128 |
Document and Array | Document, Array |
Binary and ObjectId | Binary, ObjectId |
Boolean Type | Boolean |
Date and Timestamp | Date, Timestamp |
Special Types | Min 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:
- Specific database access
- All databases access
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" }
]
})
use admin
db.createUser({
user: "xpipes",
pwd: "your_password",
roles: [
{ role: "readAnyDatabase", db: "admin" },
{ 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:
- Stop the balancer:
sh.stopBalancer()
- Clean orphaned documents:
db.runCommand({cleanupOrphaned: "db.collection"})
- 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