// This module is included in the following assemblies:
// as_connecting-to-odata.adoc

[id='creating-mongodb-connections_{context}']
= Creating a connection to a MongoDB database

Create a MongoDB connection so that you can 
connect to a MongoDB database in an integration. 

.Prerequisites

* You must know the host name for the MongoDB database that you want
to connect to. 
* You must have a user name and password that authorizes 
access to the MongoDB database. 

.Procedure

. In {prodname}, in the left panel, click *Connections* to
display any available connections.
. Click *Create Connection* to display
connectors.  
. Click the *MongoDB* connector.
. Configure the connection:
.. In the *Database host(s)* field, specify one or more MongoDB 
database hosts that this connection can access. Separate multiple 
specifications of `_host:port_` with commas. Replace `_host_` with 
a host name, a virtual host name, or an IP address. For example: 
`mongodb0.example.com:1234,mongodb1.example.com:1234`. 
.. In the *Username* field, enter a user name that is authorized to 
access the database. 
.. In the *Password* field, enter the password for the user name 
that you specified. 
.. Optional. In the *Administration database* field, 
if the database has an administration database, 
enter the name of the MongoDB
administration database that is used to grant access permission. 
A MongoDB administrator should let you know whether the database 
that you want to access has an administration database. 
.. Optional. In the *Replica set name* field, 
specify the name of the MongoDB replica set (cluster) that the 
connection can access. 
.. In the *Database* field,  enter the name of the MongoDB 
database that contains the collection(s) that you want the 
connection to read.  

. Click *Validate*. {prodname} immediately tries to validate the 
connection and displays a message that indicates whether 
validation is successful. If validation fails, revise the input 
parameter(s) and try again.
. When validation is successful, click *Next*.
. In the *Name* field, enter your choice of a name that
helps you distinguish this connection from any other connections.
For example, you might enter `MongoDB North`.
. In the *Description* field, optionally enter any information that
is helpful to know about this connection. 
. Click *Save* to see that the connection you 
created is now available. If you entered the example name, you would 
see that *MongoDB North* appears as a connection that you can 
choose to add to an integration. 

.Next step
Add your MongoDB connection to an integration. 
