MongoDB links: API guide , Authentication
Start establishing a connection to MongoDB in either of the following ways:
-
From the Resources menu, select Connections. Then, click + Create connection at the top right.
– or –
-
While working in a new or existing integration, you can add an application to a flow simply by clicking Add source or Add destination.
In the resulting Application list, click MongoDB.
The Create connection pane then asks you to name the new connection.
Be sure to provide a clear and distinguishable Name as soon as the connection is created. Throughout integrator.io imports and exports, you will have the option to choose this new connection, and a unique identifier will prove helpful later when selecting among a list of connections that you’ve created.
Click Next to configure the connection.
At this point, you’re presented with a series of options for modifying the MongoDB authorization.
MongoDB setting |
Values |
---|---|
Mode (required) |
The MongoDB connection will work with a Cloud (remote) or On-premise (network) server; for On-premise, there’s an additional step to specify an Agent. |
Agent (optional, enabled when Mode is On-premise) |
Select an agent from the list. To connect to an on-premise application, integrator.io requires that an agent be installed on a networked computer. An agent is a small application that allows you to connect to data behind your firewall. When installing an agent, you will specify a unique access token, which then populates the Agent drop-down list. The installed agents connect to integrator.io and establish a reverse SSH tunnel, allowing secure communication without the need to whitelist integrator.io’s IP addresses in your firewall settings. A single agent can be used by multiple different connections. |
Host(s) (required) |
Enter the hostname or IP address for your MongoDB instance – for example: mongodb-instance1.com or 172.16.254.1. By default, integrator.io will connect to port 27017. If you need to connect to a different port, then append :port to your hostname – for example: mongodb-instance1.com:12345 or 172.16.254.1:98765. If you are connecting to a MongoDB cluster, then list all hostname:port combinations, separated by commas – for example: mongodb-instance1.com:12345,mongodb-instance2.com:12345,mongodb-instance3.com:12345. |
Database (optional) |
Enter the name of the database you would like to connect to. If left blank, the “admin” database will be queried. |
Username (required) |
Enter the username for the account set up by the MongoDB server administrator. |
Password (required) |
Enter the password for this account, if required. |
The following example reviews a MongoDB Atlas installation. First, click the Connect button on your cluster:
In the resulting Connect to... menu, click Connect your application.
Under Choose your driver version, select the following settings:
-
Driver: Node.js
-
Version: 2.2.12 or later
Important
Do not set Version to MongoDB 3.0+.
Before closing this dialog, under Connection string only click the Copy button. Then, paste the contents into a text editor. For example:
mongodb://mongodb-server : <password> @ mongodb-adaptor-server-00-00-5xtno.mongodb.net:27017,mongodb-adaptor-server-00-01-5xtno.mongodb.net:27017 / test ? ssl=true &replicaSet= mongodb-adaptor-server &authSource= admin&retryWrites=true&w=majority
The properties we need from this string are derived as follows:
Connection field |
Connection string |
Sample value |
Host(s) |
mongodb-adaptor-server-00-00-5xtno.mongodb.net:27017,mongodb-adaptor-server-00-01-5xtno.mongodb.net:27017 |
mongodb-adaptor-server-00-00-5xtno.mongodb.net:27017,mongodb-adaptor-server-00-01-5xtno.mongodb.net:27017 |
Database name |
test |
test |
Username |
mongodb-server |
mongodb-server |
Password |
<password> |
<password> |
Replica set |
mongodb-adaptor-server |
mongodb-adaptor-server |
TLS/SSL |
ssl=true |
[Check the box] |
Auth source |
admin |
admin |
Continuing in the Create connection pane, you have the opportunity to provide additional configuration information, if needed, for the MongoDB server.
MongoDB setting |
Values |
Replica set (optional) |
Enter the name of the replica set. The replica set members must be supplied in the Host(s) field, above. |
TLS/SSL (optional) |
Check this box to enable TLS/SSL security for the connection. |
Auth source (optional) |
Enter the name of the database associated with the user’s credentials. If you do not specify an Auth source database, then the Database field above will be used as the default. |
Once you have configured the MongoDB connection, you have a few options for continuing:
-
Test – click this button to verify that your new connection is free of errors
-
Test and save – click this button to test the connection, commit the new connection so that it will be available to all integrations for your account (and applied to the current source or destination app, if you created it within a flow)
-
Cancel – click this link to exit connection creation without saving
Comments
Please sign in to leave a comment.