As its name suggests, MongoDB Charts is all about creating graphical visualizations of data stored in MongoDB. However, sometimes it can be very helpful to see the numbers behind the chart. Perhaps you want to double-check the data is correct, or you may want to export the data to do some further analysis using a different tool.
The latest update to Charts, now available as a part of MongoDB Atlas, provides a simple way to get the data underpinning a chart. The Chart Builder dialog, used when adding or editing a chart, has a new menu for data exploration that is labelled with an ellipsis (three dots). The menu contains three options: View Source Documents, View Aggregation Pipeline and Get Chart Data.
Let’s take a look at how each of these options allows you to explore your data.
- View Source Documents: This lets you view 20 sample documents from the collection, after any query or filters have been applied, but before Charts transforms the data. This command can be useful if you want to understand more about the values used in the original documents to help you author the right chart. (If you need a more powerful tool for exploring the raw documents, try out MongoDB Compass or the Data Explorer in Atlas).
- View Aggregation Pipeline: This lets you view the MongoDB aggregation pipeline that Charts creates based on your chart definition. Seeing this can be helpful if you want to understand how Charts is transforming your data or if you want to run the same transformation in the mongo shell or a similar tool. You can also import the pipeline into MongoDB Atlas's Aggregation Pipeline Builder.
- Get Chart Data: This lets you see the transformed data that is ultimately used to render the chart. You can also export the data to either CSV or JSON format. This can be useful if you want to see the exact values used to create the chart or if you want to download the data for analysis in a different tool.
These new commands give you a more complete view of what Charts is doing behind the scenes to turn your original data into beautiful visualizations. We hope these updates help you get even more insight into your data and open up new scenarios for using MongoDB Charts.
Other new features
The data exploration features are just some of the new capabilities included in the most recent Atlas release of Charts. Other new features include the ability to change the data type of fields while building charts (useful if you have dates or numbers stored as strings), and the freedom to place charts across the full width of a dashboard when using a large screen.