---
title: "MongoDBConnectionService"
slug: "mongo-db-connection-service"
updated: 2026-06-09T05:58:44Z
published: 2026-06-09T05:58:44Z
canonical: "docs.lobstersoftware.com/mongo-db-connection-service"
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.
# MongoDBConnectionService
This service is used internally, but it is also necessary if you want to work with the MongoDB input agent.
## XML configuration
A new MongoDB database alias can be added with an XML fragment of the following type.
### Minimal configuration
```xml
true
mydatabase
mongodb:plain://192.168.111.103:27017
0
mydatabase
```
The parameters have the following meaning.
| alias | The database alias to use. |
| --- | --- |
| catalogName | The name of the catalog (schema) within the MongoDB (also called "databaseā). If omitted, the alias name is used. |
| minSize | The initial size of the connection pool when starting the service. |
| The connection string (here mongodb:plain://192.168.111.103:27017) | **IMPORTANT:** Currently only the authentication method "plain" is supported. This means that when you log on to the MongoDB, the password is transmitted in plain text. You also have to configure your MongoDB accordingly. Please refer to the manufacturer's documentation for this. |
### Configuration with user and password
```xml
mydatabase
mongodb:plain://localhost:27017
username:mydatabase
password
0
mydatabase
```
You must specify the database name with the user.
### Configuration for MongoDB replica set (cluster)
A replica set is a cluster of n MongoDBs (usually three, with one primary MongoDB and two secondary MongoDBs). If the primary MongoDB is down, one of the secondary MongoDBs takes over. You don't have to do anything for this, it is done automatically, but all participants must be known.
```xml
mongodb_cluster
- mongodb:plain://localhost1:27017/?replicaSet=rs-ips
- mongodb:plain://localhost2:27017
- mongodb:plain://localhost3:27017
- username:mydatabase
- username:mydatabase
- username:mydatabase
- password
- password
- password
0
mydatabase
```
As you can see, the first connection string must contain the name of the replica set (here "rs-ips").
Usually, identical usernames, passwords are used on the different MongoDBs and we recommend this, but you could also use different ones. You also must specify the database name for each user and it must always be the same.
If you then use the input agent MongoDB, for example, simply specify the alias (here "mongodb_cluster"), everything else happens automatically in the background.