0
0
MongodbHow-ToBeginner · 3 min read

How to Use Atlas Charts in MongoDB Atlas

To use Atlas Charts, first connect your MongoDB Atlas cluster to the Charts interface, then create charts by selecting collections and fields to visualize your data. You can customize chart types, filters, and layouts directly in the Atlas UI without coding.
📐

Syntax

Atlas Charts does not use traditional code syntax but follows a visual setup process:

  • Connect Data Source: Link your MongoDB Atlas cluster to Charts.
  • Create Chart: Choose a collection and fields to visualize.
  • Select Chart Type: Pick from bar, line, pie, table, etc.
  • Configure: Apply filters, groupings, and customize appearance.
  • Save and Share: Save charts to dashboards and share with your team.
mongodb
No code syntax; use Atlas UI to create charts visually.
💻

Example

This example shows how to create a bar chart to display total sales per product category from a sales collection.

text
1. Open MongoDB Atlas and go to the Charts tab.
2. Click 'Create Chart'.
3. Select your cluster and the 'sales' collection.
4. Choose 'Bar Chart' as the chart type.
5. Set 'Category' field on the X-axis.
6. Set 'Sum of SalesAmount' on the Y-axis.
7. Apply any filters if needed (e.g., date range).
8. Click 'Save' and add the chart to a dashboard.
Output
A bar chart showing product categories on the X-axis and total sales amounts on the Y-axis.
⚠️

Common Pitfalls

Common mistakes when using Atlas Charts include:

  • Not connecting the correct cluster or collection, resulting in no data.
  • Choosing incompatible fields for chart axes (e.g., text on Y-axis).
  • Forgetting to apply filters, causing cluttered or misleading charts.
  • Not saving charts, losing your work.

Always verify your data source and preview charts before saving.

text
Wrong: Selecting a text field for Y-axis in a bar chart.
Right: Use a numeric field like 'SalesAmount' for Y-axis aggregation.
📊

Quick Reference

StepActionNotes
1Connect Data SourceLink your Atlas cluster to Charts
2Create ChartSelect collection and fields
3Choose Chart TypeBar, line, pie, table, etc.
4Configure ChartSet axes, filters, groupings
5Save & ShareAdd to dashboard and share

Key Takeaways

Atlas Charts lets you visualize MongoDB data without coding by using a visual interface.
Always connect the correct cluster and collection before creating charts.
Choose appropriate fields and chart types to represent your data clearly.
Use filters and groupings to focus your charts on relevant data.
Save your charts and organize them in dashboards for easy sharing.