Skip to content

Connect a database from MongoDB Atlas

This guide will take you through all the neccessary steps needed to connect a database from a MongoDB Atlas account to Florentine.ai:

Create a readonly user

Start by logging in to your MongoDB Atlas account. Navigate to Projects and select the project where the database you want to connect is located:

Project select

Next, navigate to Database Access and click on Add New Database User on the right:

Add new user select

In the opening modal for creating a new user, keep the default Password selection as Authentication Method.

In the Password Authentication section, create a username and a password. Make sure you copy the username and password, because you need it for the connection string later.

In the Database User Privliges section, select Only read any database option from the Built-in Role select.

Finally click on Add User.

Add new user

Grant network access

Besides a user with database access Florentine.ai needs network access as well. Navigate to Network Access and click on Add IP Address:

Add IP address select

In the opening modal you need to enter the Florentine.ai IP 167.99.246.57 inside the Access List Entry input.

Optionally you may also add a comment to help you identify this is the Florentine.ai IP address.

Finally click on Confirm:

Add IP to whitelist

For better failover security, we recommend adding the additional Florentine IP 209.38.238.253 as well.

Copy and modify connection string

Navigate to Clusters and, next to the cluster with the database you want to connect with Florentine.ai, click on Connect:

Connect select

In the opening modal, click on Drivers in the Connect to your application section:

Connect step 1

Copy the connection string found under the section 3. Add your connection string into your application code:

Connect step 2

Now you shoud have a connection string that looks i.e. like this:

mongodb+srv://<db_username>:<db_password>@cluster.2mwtw.mongodb.net/?retryWrites=true&w=majority&appName=Florentine

Now in order to connect with Florentine.ai you need to modify the connection string as follows:

Replace <db_username> and <db_password> with the values you copied when you created the readonly user earlier.

Next, replace all query params, so everything from ? onwards, with your database name.

So your final connection string to add in your Florentine.ai account should look comparable to this one:

mongodb+srv://user:[email protected]/samples