View and Export Chart Data¶
While editing a chart in the Chart Builder, you can view underlying data from the Ellipses (...) dropdown menu. Access to underlying data is intended to help you build meaningful charts as well as export that data for use with third-party tools.
View Source Documents¶
Once you have selected a data source for your chart, you can view up to 20 sample documents from that data source by clicking View Source Documents from the menu.
The sample documents are intended for reference to help you build a chart. The documents do not reflect any groupings or projections applied to an existing chart (i.e. any Encode panel options in the Chart Builder). The documents are produced with a query on your data source that considers:
- Pipelines applied to the data source
- Sample mode (if toggled on)
- Queries or pipelines specified in the Chart Builder
- Filters applied in the Filter Tab
The Source Documents modal displays the number of documents from your data source that match your query conditions, although only 20 of the documents are viewable as samples.
View Aggregation Pipeline¶
After you have configured a valid chart, you can view the source query for the chart. MongoDB Charts uses a special type of query to create a chart called an aggregation pipeline. To view the query, click View Aggregation Pipeline from the menu. This aggregation pipeline includes the stages that both the data source and the Chart Builder apply.
Some Chart Builder configuration options don't apply aggregation stages. These options are applied to a chart's visualization and do not affect the underlying data.
Get Chart Data¶
After you have configured a valid chart, you can view and export the underlying data as a table. To view the chart data, click Get Chart Data from the menu. Each row in the table represents a data point.
Some configuration options you see reflected on a chart visualization are not applied to the data table. The Chart Data table displays underlying data retrieved with your full aggregation pipeline, and not all Chart Builder configuration options apply aggregation stages. Review your data to verify its contents.
If you want to analyze your underlying data with a third-party tool, you can download your data from the Chart Data modal. To download your data, click Download - CSV or Download - JSON.