MongoDB connection
To access your data in MongoDB, create a connection asset for it.
MongoDB is a distributed database that stores data in JSON-like documents.
Supported editions and versions
MongoDB editions
- MongoDB Community
- IBM Cloud Databases for MongoDB. See IBM Cloud Databases for MongoDB connection for this data source.
- MongoDB Atlas
- WiredTiger Storage Engine
MongoDB versions
- MongoDB 3.6 and later, 4.x, 5.x, and 6.x
- Microsoft Azure Cosmos DB for MongoDB 3.6 and later, 4.x
Create a connection to MongoDB
To create the connection asset, you need these connection details based on your deployment:
Common connectivity
- Hostname or IP address: The hostname or IP address of the database.
- Port number: The port of the database.
- Authentication database: The name of the database in which the user was created.
- Database: This is the name of the database. If you do not enter a database name, you must enter the catalog name, schema name, and the table name in the properties for SQL queries.
- Column discovery sample size: The number of rows sampled per collection to determine table schemas. The default value is 1000.
- Schema filter: A comma-separated list of database collection pairs for which the driver should fetch metadata.
- Special character behaviour: Specifies what should be done to special characters in names that do not conform to SQL identifier syntax. The options you can choose from are:
- Include: Leave the special characters and keep them in the name.
- Replace: Replace the special characters with underscores.
- Strip: Remove the special characters. This is the default action.
StreamSets
- Hostname or IP address: The hostname or IP address of the database.
- Database: This is the name of the database. If you do not enter a database name, you must enter the catalog name, schema name, and the table name in the properties for SQL queries.
- Protocol: Choose the protocol used for the connection. Based on the option you choose, the connection details needed will change. The options are:
- Standard
- SRV
- Port number: The port of the database. Available for the Standard protocol.
- Alternate Servers: Servers to use in addition to the specified host and port. Available for the Standard protocol.
- Additional parameters: Additional parameters you can use, like appName or retryWrites. Available for the Standard protocol.
- Compression algorithm: The compression algorithm used to communicate with the MongoDB. The options are:
- None
- Snappy
- Zlib
- Zstandard
Credentials
You have specific authentication methods based on your deployment:
Common connectivity
- Username and password
StreamSets
Choose an authentication method:
-
LDAP
- Username and password
-
Username and password
- Authentication mechanism: choose the mechanism for how the client communicates with the server. The options are:
- Default: The client negotatiates with the server.
- SCRAM-SHA-1
- SCRAM-SHA-256
- Username and password
- Authentication mechanism: choose the mechanism for how the client communicates with the server. The options are:
Certificates
You can enable SSL for each deployment:
Common connectivity
- Port is SSL-enabled: Enable this option if the port you have chosen is configured to accept SSL connections.
If the Port is SSL-enabled option is enabled, fill in the following fields:
- SSL certificate: Enter the SSL certificate of the host to be trusted
- Hostname in SSL certificate: The hostname in SubjectAlternativeName or Common Name (CN) part of the SSL certificate
- Validate the SSL certificate: Enable this option to validate that the SSL certificate returned by the host is trusted.
StreamSets
- Port is SSL-enabled: Enable this option if the port you have chosen is configured to accept SSL connections.
If the Port is SSL-enabled option is enabled, fill in the following fields:
- SSL certificate: Enter the SSL certificate of the host to be trusted
- Client certificate: Enter the full certification value.
- Client private key: Enter the full key value.
- Private key password: Enter the password to access the Private Key file, if it is encrypted.
- SSL invalid host name allowed: Enable this option to remove the validation of hostnames in the certificates. This option will let you use the connection even if the hostname in the server certificates does not match the server's host.
For Private connectivity, to connect to a database that is not externalized to the internet (for example, behind a firewall), you must set up a secure connection.
MongoDB setup
Restrictions
- You can only use this connection for source data. You cannot write to data or export data with this connection.
- MongoDB Query Language (MQL) is not supported.
Learn more
Related connection: IBM Cloud Databases for MongoDB connection