Navigation
This documentation refers to the on premises version of MongoDB Charts. For documentation on the MongoDB Charts SaaS application in Atlas, click here.

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 the Modify a Data Source section.

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 the Modify a Data Source section.

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 the Modify a Data Source section.

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

  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.

    Important

    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 Configure TLS/SSL for Data Sources.

  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.

Modify a Data Source

MongoDB Charts users can modify certain properties of a data source provided they have appropriate permissions on the target data source. The following data source properties may be modified after a data source has been created:

Modify Data Source Alias

A data source Manager or Owner can modify the Alias of a data source by hovering over the row’s Alias field, then clicking either Add Alias or the edit button (pencil icon). Click the green check mark to save the alias.

Modify Deployment Connection URI

A datasource Manager or Owner can modify the Deployment Connection String URI of a data source. This lets you seamlessly change the MongoDB cluster from which the data source pulls its data, or change connection details such as authentication passwords and SSL options.

  1. From the Data Sources view, click the ellipsis () button on the right-hand side of the data source you want to modify.

  2. Click Edit Deployment Connection.

  3. In the Edit Deployment Connection dialog, enter the new connection URI in the input.

  4. Click Test Connection to ensure you have supplied a valid connection URI.

    Important

    Below the connection URI input, MongoDB Charts lists all of the data sources currently sharing the same deployment connection. If the MongoDB deployment corresponding to the updated connection string URI does not contain all collections currently in use, charts using those data sources must be reconfigured using a different data source or deleted before you can update the connection URI.

Modify Data Source Permissions

A data source Owner can add, modify, and remove user permissions on a data source.

  1. From the Data Sources view, click the Access button in the Permissions column for the data source you want to modify permissions.
  2. Perform the desired permission changes for the data source. Refer to the Data Source Permissions page for details on the permissions available and instructions on setting the permissions.
  3. Click Apply Changes.

Remove a Data Source

Important

To remove a data source, you must have the Owner permission on that data source.

To remove a data source:

  1. From the Data Sources view, click the ellipsis () button on the right-hand side of the data source you want to delete.
  2. Click Delete Data Source.
  3. Click Delete Data Source again in the dialog to confirm deletion.

Important

Any charts using the deleted data source will need to be reconfigured using a different data source or deleted.