MongoDB Connection
The MongoDB connection type enables automations to query, insert, update, and delete documents in MongoDB databases. It is used by the plugin-nosql-databases plugin, which delegates to the nosql-database-connector.
Connection Type
| Property | Value |
|---|---|
| Type enum | MONGODB |
| Type ID | mongodb |
| Category | Database |
| Entity class | NoSQLDBConnectionDetails |
Friendly Example
| What you enter | Example |
|---|---|
| Connection name | MongoDB - Customer Records |
| Used for | Reading or updating approved document data for workflows |
| Main details to collect | Connection string, database name, username, and password |
| Best person to provide it | Database administrator |
After it is saved, workflow builders select MongoDB - Customer Records in a node instead of entering these details again.
Mandatory Fields
| Field | Type | Required | Description |
|---|---|---|---|
database | DatabaseType | Yes | Set to MONGODB (or the appropriate NoSQL database type if using a different engine through the same connector). |
jdbcUrl | String | Yes | MongoDB connection string URI. Despite the field name, this accepts a standard MongoDB URI (see format below). |
username | String | Yes | MongoDB authentication username. |
password | String | Yes | MongoDB authentication password. Encrypted at rest. |
Advanced Fields
| Field | Type | Required | Description |
|---|---|---|---|
port | String | No | MongoDB port. Defaults to 27017. This is typically included in the connection URI but can be specified separately. |
Connection String Format
The jdbcUrl field accepts a standard MongoDB connection URI:
Standard Format (Standalone or Replica Set)
mongodb://host1:27017,host2:27017,host3:27017/databaseName?replicaSet=myReplicaSet&authSource=admin
SRV Format (Atlas and DNS-based discovery)
mongodb+srv://cluster0.abcdef.mongodb.net/databaseName?retryWrites=true&w=majority
Common URI Parameters
| Parameter | Description | Example |
|---|---|---|
authSource | Database used for authentication. Defaults to admin. | authSource=admin |
replicaSet | Replica set name. Required for replica set connections when not using SRV. | replicaSet=rs0 |
ssl | Enable TLS/SSL. | ssl=true |
tls | Alias for ssl. Preferred in newer drivers. | tls=true |
tlsAllowInvalidCertificates | Skip certificate validation. Not recommended for production. | tlsAllowInvalidCertificates=true |
retryWrites | Enable retryable writes. | retryWrites=true |
w | Write concern. | w=majority |
maxPoolSize | Maximum connection pool size. | maxPoolSize=50 |
connectTimeoutMS | Connection timeout in milliseconds. | connectTimeoutMS=10000 |
The username and password can be included in the URI (mongodb://user:pass@host/db) or provided separately in the username and password fields. When provided separately, they take precedence. Using the separate fields is recommended because the password will be encrypted at rest by the Global Configurator.
Setup Instructions
-
Create a dedicated MongoDB user for automation use:
use admin
db.createUser({
user: "qinfinite_automation",
pwd: "strong-password",
roles: [
{ role: "readWrite", db: "target_database" }
]
})For read-only access, use the
readrole instead ofreadWrite. -
Ensure network connectivity. The MongoDB port (default 27017) must be reachable from the Qinfinite platform. For MongoDB Atlas, add the platform's IP addresses to the Atlas IP Access List.
-
Construct the connection URI with the appropriate hosts, database name, and options.
-
Create the connection in the Global Configurator.
-
Test the connection to verify credentials and network access.
Troubleshooting
| Symptom | Likely Cause |
|---|---|
Connection refused | MongoDB is not running on the specified host/port, or a firewall is blocking access |
Authentication failed | Wrong username, password, or authSource. Verify the user exists in the authentication database. |
not authorized on [db] to execute command | The user does not have the required role on the target database |
MongoTimeoutException | Network connectivity issue, or the connection URI has unreachable hosts |
SSL handshake failed | TLS is required by the server but not enabled in the URI, or certificate validation failed |