MongoDB Driver Documentation
This documentation explains the MongoDB driver implementation and how connection parameters map to UI fields in the Gigantic application.
Connection Parameters
| UI Field | Technical Implementation | Description | Required | Default Value |
|---|---|---|---|---|
| Host | host in mongodb connection config | The hostname or IP address of the MongoDB server | Yes | localhost |
| Port | port in mongodb connection config | The port number MongoDB server is listening on | Yes | 27017 (from driverPorts) |
| Database | db in mongodb connection config | The name of the database to connect to | Yes | None (must be specified) |
| Username | user in mongodb connection config | Database user for authentication | No | None |
| Password | password in mongodb connection config | Password for the database user | No | None |
Technical Details
The MongoDB driver implementation uses the mongodb Node.js library with MongoClient for connections.
- Document-based database using collections instead of tables
- Connection string format:
mongodb://host:portor custom URL viaconfig.url - Schema extraction performed by sampling documents from collections
- Foreign key relationships detected by looking up ObjectId references across collections
- Uses document sampling approach for schema inference
- Supports connection options like
useUnifiedTopology: true
When SSH tunneling is enabled, connections are first established through the tunnel before connecting to the MongoDB server.
Authentication Options
MongoDB supports standard username/password authentication and also connection string based authentication.
| Auth Type | UI Mapping | Description |
|---|---|---|
| None | No username/password fields | Connects without authentication |
| Password | Username/Password fields | Standard username/password authentication |
| Password Manager | Various password manager fields | Fetches credentials from external password managers |
SSH Tunnel Support
The MongoDB driver supports SSH tunneling for secure access to databases behind firewalls or in private networks. For detailed information on configuring SSH tunnels, please refer to the SSH Tunnelling documentation.
API Endpoints Used
MongoDB connections are primarily used in:
- Tap creation (data source discovery)
- Sink creation (data destination for anonymized data)
- Pipeline execution (data extraction and loading)
Custom Params
The MongoDB driver supports additional custom parameters that can be specified in YAML format to fine-tune connection behavior, pooling, SSL settings, and other advanced options.
Connection Parameters
# SSL/TLS Configuration
tls: true
tlsCAFile: /path/to/ca.pem
tlsCertificateKeyFile: /path/to/client-cert.pem
tlsCertificateKeyFilePassword: certificate_password
tlsAllowInvalidCertificates: false
tlsAllowInvalidHostnames: false
tlsInsecure: false
# Authentication Options
authMechanism: "SCRAM-SHA-256" # or "SCRAM-SHA-1", "MONGODB-X509", "GSSAPI", "PLAIN"
authSource: "admin"
authMechanismProperties:
SERVICE_NAME: "mongodb"
CANONICALIZE_HOST_NAME: false
# Timeout Settings
connectTimeoutMS: 30000
socketTimeoutMS: 360000
serverSelectionTimeoutMS: 30000
heartbeatFrequencyMS: 10000
maxIdleTimeMS: 30000
# Read Preferences
readPreference: "primary" # or "primaryPreferred", "secondary", "secondaryPreferred", "nearest"
maxStalenessSeconds: 90
# Compression
compressors: ["snappy", "zlib"]
zlibCompressionLevel: 6Pool Configuration
# Pool sizing options
maxPoolSize: 100
minPoolSize: 10
maxConnecting: 2
# Pool timeout options
maxIdleTimeMS: 30000
waitQueueTimeoutMS: 0Example Configurations
Basic Configuration
maxPoolSize: 50
serverSelectionTimeoutMS: 5000SSL Configuration
tls: true
tlsCAFile: ${file:/path/to/ca-cert.pem}
tlsCertificateKeyFile: ${file:/path/to/client-cert.pem}
tlsCertificateKeyFilePassword: cert_password
authMechanism: "MONGODB-X509"Replica Set Configuration
host: rs1.example.com,rs2.example.com,rs3.example.com
port: 27017
database: replicated_db
readPreference: "secondaryPreferred"
maxStalenessSeconds: 120
maxPoolSize: 25
minPoolSize: 5
compressors: ["snappy"]