How to Visualise Database in MongoDB Compass in MongoDB Charts
MongoDB is one of the most powerful NoSQL databases in modern development. However, raw data alone does not provide insights unless it is properly visualized. This is where MongoDB Compass and MongoDB Charts come in.
In this complete guide, you will learn how to explore, transform, and visualize MongoDB data step-by-step like a professional data engineer.
Official references:
MongoDB Compass Docs
MongoDB Charts Docs
Aggregation Pipeline
MongoDB Atlas Charts
Understanding MongoDB Compass vs MongoDB Charts
Before visualizing data, you must understand both tools clearly.
MongoDB Compass
Compass is a GUI tool used to explore and query MongoDB databases visually. It is mainly for developers.
MongoDB Charts
Charts is a cloud-based visualization tool that turns MongoDB data into dashboards for analytics and business insights.
| Feature | Compass | Charts |
|---|---|---|
| Purpose | Database exploration | Data visualization |
| User Type | Developers | Analysts & Teams |
| Output | Query results | Dashboards & charts |
Step 1: Setting Up MongoDB Compass
Install Compass and connect to your cluster:
mongodb+srv://username:password@cluster.mongodb.net/
After connection, you can browse collections, inspect documents, and run queries visually.
Step 2: Preparing Data for Visualization
Data must be structured properly before visualization.
{
"name": "Adebayo John",
"class": "SS2",
"subjects": {
"math": 85,
"english": 78,
"physics": 90
},
"attendance": 95
}
Clean data ensures accurate charts and better insights.
Step 3: Aggregation Pipeline (Core of Visualization)
Aggregation transforms raw data into structured insights.
[
{
"$project": {
"name": 1,
"totalScore": {
"$add": [
"$subjects.math",
"$subjects.english",
"$subjects.physics"
]
}
}
}
]
Step 4: Connecting to MongoDB Charts
Charts connects through MongoDB Atlas, not directly Compass.
- Open MongoDB Atlas
- Go to Charts
- Select cluster
- Choose collection
Step 5: Creating Charts
Choose chart type based on your data:
- Bar Chart ? comparison
- Line Chart ? trends
- Pie Chart ? distribution
Step 6: Advanced Visualization
Filters help refine data:
{ "class": "SS2" }
Time-based visualization requires date fields:
"createdAt": ISODate("2026-01-01")
Best Practices
- Keep data structured
- Use indexes
- Avoid deep nesting
- Use aggregation pipelines
- Keep dashboards simple
Real-World Use Cases
- School performance dashboards
- Business analytics
- IoT monitoring
- Finance tracking
FAQ Section
Do I need MongoDB Atlas?
Yes, MongoDB Charts works best when connected to MongoDB Atlas because it provides a cloud-managed environment that supports real-time data visualization. While you can experiment locally with MongoDB Compass, Atlas is required for full charting features and dashboard sharing.
Can Compass create charts?
No, MongoDB Compass cannot directly create charts or dashboards. It is mainly designed for database exploration, querying, and running aggregation pipelines, while MongoDB Charts handles all visualization tasks.
Is MongoDB Charts free?
Yes, MongoDB Charts offers a free tier that allows you to create and explore dashboards. However, advanced features such as higher usage limits, collaboration tools, and enterprise-level performance may require a paid Atlas plan.
Can I use local MongoDB?
You can use local MongoDB with Compass, but MongoDB Charts is primarily optimized for MongoDB Atlas. For full functionality like sharing dashboards and live updates, Atlas is strongly recommended.
What is aggregation?
Aggregation in MongoDB is a framework used to process and transform data into meaningful results. It allows you to group, filter, and compute values from your collections so they can be used in charts and analytics.
Can I embed charts?
Yes, MongoDB Charts allows you to embed dashboards directly into websites using secure embed links. This makes it easy to display live data visualizations on blogs, applications, or internal systems.
What is the best chart type?
Bar charts are generally the best for comparing categories because they clearly show differences between values. However, line charts are better for trends, while pie charts are ideal for showing proportions.
Does Charts update in real time?
Yes, MongoDB Charts can update in real time when connected to live data in MongoDB Atlas. This makes it very useful for dashboards that track continuously changing data like sales, traffic, or system metrics.