Navigation
This documentation refers to the on-premises edition of MongoDB Charts. Read the Atlas service documentation to learn how to use MongoDB Charts with your Atlas project.

Data Sources

Data sources in MongoDB Charts reference a collection or view in your MongoDB deployment. When building a chart, you will need to specify the data source that the chart uses.

To view, add, or remove data sources, click Data Sources on the top navigation bar.

Data Sources View

The Data Sources view displays existing data sources that the currently logged-in user has permission to view. The data sources are displayed in a tabular format with the following columns:

Diagram of the "Data Sources" view
Column Description
Deployment

The MongoDB deployment containing the source database and collection. Identified by the hostname and port of the first host in the Connection String URI.

To modify a deployment’s connection URI, see Manage Existing Data Sources.

Database The database containing the source collection or view.
Collection The collection or view from where Charts retrieves data.
Alias

Optional. The display name of the data source used by the Chart Builder. Providing an Alias may result in a shorter and more identifiable name when selecting a data source in the chart builder.

To modify the Alias for a data source, see Manage Existing Data Sources.

Last modified The date the data source was last modified.
Permissions

The icon next to the Access button denotes the permissions you have on the data source. For details on the various data source permissions, see Data Source Permissions.

To modify the permissions for a data source, see Manage Existing Data Sources.

Note

You can sort data sources by any of the columns by clicking on the column header.

Filter Data Sources

To search for specific data sources, use the search bar at the upper right corner of the Data Sources view. You can search by Deployment, Database, Collection, or Alias.

Additionally, you can use the dropdown to the left of the search bar to show either all data sources on your MongoDB Charts deployment, or only data sources for which you have the Owner permission. For more information on data source permissions, see Data Source Permissions.

Add a Data Source

Considerations

MongoDB Charts requires that MongoDB deployments run version 3.4 or later.

If your MongoDB deployment is running with authentication enabled, include a database user’s credentials in the connection string URI. Anonymous, SCRAM, and LDAP authentication mechanisms are supported. The database user must have read permissions on the collections selected in the following step.

If the authenticated user does not have the listDatabases privilege on the deployment specified in the URI, they can still add the data source by specifying the desired database as part of the URI. In this case, the URI takes the following form:

mongodb://[username:password@]<server>:<port>/<database>

If your deployment is running with TLS/SSL enabled, add the ssl=true option to the URI:

mongodb://[username:password@]<server>:<port>/<database>?ssl=true

For more information, see Connect to a TLS/SSL-Enabled Data Source.

Procedure

  1. From the Data Sources view, click the New Data Source button.

  2. Enter the Connection String URI of the MongoDB deployment to which you want to connect.

  3. Click Connect.

  4. Select the collections from which you wish to create data sources. Charts creates a separate data source for each selected collection.

  5. Click Set Permissions.

  6. Set the permissions for the data source. You can search for specific users by name or email address using the search bar.

  7. Click Publish Data Source.

    Note

    If you selected multiple collections for your data source in step 4, the data source permissions you select are applied to all of the selected collections when you publish your data source. If you wish to apply different permissions to individual collections that you have selected, you will need to edit those data sources after publishing.

You will see your newly added data source listed in the Data Sources view. To learn how to manage existing data sources, see Manage Existing Data Sources.

Enable or Disable Embedding

As a data source Owner, you can allow other people to embed charts which use your data source in external web pages. In order to allow a chart to be embedded in an external web page, you must enable embedding both on the data source and the individual chart.

Embedding is disabled by default for all data sources. To enable embedding for a data source:

  1. Navigate to your Data Sources View page.

  2. Click the ellipsis () button on the far right side of the desired data source.

  3. Select Embedding Options from the dropdown menu.

  4. Toggle the switch in the top right corner to On.

  5. Select either:

    1. Verified Signature only. This option requires embedded charts to include a secret embedding key with each request sent to the data source. Without a verified signature, the chart will not render. This option allows the chart owner to ensure that the chart is used only in its intended context.

      Generating a verified signature for authorized users to include with their embedded charts requires some server-side code. Examples in several languages and platforms are available with the verified signature documentation.

    2. Unauthenticated or Verified Signature. This option allows the chart to be viewed either with or without a verified signature, so that anyone with the link may view the embedded chart. It is simpler to implement than the verified signature only option, but it is less secure. It should only be used for charts which display non-sensitive data.

After enabling embedding for a data source, you can enable embedding for individual charts which use that data source.

Note

If you change the embedding option for a data source from On to Off, all embedded charts which use that data source will stop rendering immediately.