Intro
MongoDB is an open-source document-oriented database system that stores structured data as JSON-like documents with dynamic schemas. Domo provides connectors that allow you to pull data from a MongoDB collection and compile custom reports.- The MongoDB connector uses Java driver version 3.2.1, and supports Find and Aggregate query methods. You need to enter the Collection name manually in the MongoDB connector.
- The MongoDB Advanced connector uses Java driver version 3.2.1, and supports a plain JSON query. You need to enter the Collection name manually in the MongoDB Advanced connector.
- The MongoDB V2 connector uses Java driver version 3.12.1, and supports Find and Aggregate query methods. You can either select the Collection name from the drop down or enter it manually in the MongoDB V2 connector. Also, MongoDB V2 connector doesn’t require a CA certificate.
- The MongoDB SSH Connector uses Java driver version 3.12.1, and supports Find and Aggregate query methods. You can either select the Collection name from the drop down or enter it manually in the MongoDB SSH connector. You need your SSH credentials (host, port, username, and password) to pull data from a MongoDB collection through an SSH tunnel.
Prerequisites
To connect to a MongoDB collection and create a DataSet, you must have the following:- The username and password you use to log into your MongoDB database
- The host name for the database server (e.g. db.company.com ).
- The port number for the database
- The authentication database name
- The name of the collection you want to connect to
- The CA certificate text or URL path is required only if you select Certificate String or URL Path, respectively, in the Certificate Format menu.
- An SSL connection
Connecting to a MongoDB Collection
This section enumerates the options in the Credentials and Details panes in the MongoDB Connector page. The components of the other panes in this page, Scheduling and Name & Describe Your DataSet, are universal across most connector types and are discussed in greater length in Adding a DataSet Using a Data Connector.Credentials Pane
This pane contains fields for entering credentials to connect to a collection within a MongoDB database. The following table describes what is needed for each field:Field | Description |
|---|---|
Host | Enter the host name for the MongoDB database. For example: db.company.com |
Database Name | Enter the name of the MongoDB authentication database. This needs to be the specific database the user was created in. |
Collection | Enter the name of the collection you want to connect to. Note: A collection belonging to a database different than the authentication database can be accessed using databaseName.collectionName syntax. |
Username | Enter your MongoDB username. |
Password | Enter your MongoDB password. |
Database Port | Enter the port number for the MongoDB database. |
Certificate Format | Select the certificate format. If you do not want to include a certificate, select No Certificate . If you select Certificate String , you must paste the text for your certificate in the Certificate field. If you select URL Path , you must enter the URL where your certificate is located in the Certificate field. |
Certificate | Paste the text for your CA certificate or enter the URL where your certificate is located. This is optional. If you do not want to include a certificate, select No Certificate in the Certificate Format menu. |
Details Pane
In this pane you create a JSON query to pull data from your MongoDB collection. You can also create optional WHERE, SELECT, GROUP, and SORT clauses, also in JSON format.Menu | Description |
|---|---|
JSON Query | Enter the JSON query to use in selecting the data you want. Two query methods are available, Find and Aggregate . Find: You could use the Find method to select from this collection all documents where the subject equals “History.” The query would be formatted as follows: Aggregate: To use the Aggregate method, your query will look something like the following: In this example, the count stage returns a count of the remaining documents in the aggregation pipeline and assigns the value to a field called “passing scores.” |
Where Clause JSON | Enter a WHERE clause in JSON format. |
Select Clause JSON | Enter a SELECT clause in JSON format. |
Group Clause JSON | Enter a GROUP clause in JSON format. |
Sort Clause JSON | Enter a SORT clause in JSON format. |