Skip to main content

MongoDB

MongoDB is a leading document-oriented NoSQL database that revolutionizes data storage with its flexible schema design, horizontal scalability, and rich query capabilities, making it ideal for modern applications handling diverse data types.

Supported Versions and Architectures

  • Versions: MongoDB 3.6 and above (for MongoDB 3.4 and below, use "MongoDB Below 3.4" connector)
  • Architectures: Replica sets and sharded clusters, including secondary node sync

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 standalone instances, convert to single-member replica set:

rs.initiate()

2. Create Database User

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" }
]
})

3. Configure Oplog (for incremental sync)

Ensure oplog can store at least 24 hours of data:

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

4. Sharded Cluster Setup

For sharded clusters:

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

Limitations

  • Sharded clusters: Requires stopping balancer during initial sync
  • Standalone instances: Must be converted to replica set for incremental sync
  • User permissions: Sharded clusters need users created on each shard