Drivers

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 FieldTechnical ImplementationDescriptionRequiredDefault Value
Hosthost in mongodb connection configThe hostname or IP address of the MongoDB serverYeslocalhost
Portport in mongodb connection configThe port number MongoDB server is listening onYes27017 (from driverPorts)
Databasedb in mongodb connection configThe name of the database to connect toYesNone (must be specified)
Usernameuser in mongodb connection configDatabase user for authenticationNoNone
Passwordpassword in mongodb connection configPassword for the database userNoNone

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:port or custom URL via config.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 TypeUI MappingDescription
NoneNo username/password fieldsConnects without authentication
PasswordUsername/Password fieldsStandard username/password authentication
Password ManagerVarious password manager fieldsFetches 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: 6

Pool Configuration

# Pool sizing options
maxPoolSize: 100
minPoolSize: 10
maxConnecting: 2

# Pool timeout options
maxIdleTimeMS: 30000
waitQueueTimeoutMS: 0

Example Configurations

Basic Configuration

maxPoolSize: 50
serverSelectionTimeoutMS: 5000

SSL 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"]