MongoDB Charts

MongoDB Charts

Data is most valuable when it is visualized. MongoDB Charts solves this problem beautifully. It is the best way to build dashboards natively in Atlas.

What is Charts?

Charts is a built-in visualization tool. It reads directly from your MongoDB collections. It handles nested JSON structures automatically.

No Code Required

You do not need to write code to create a chart. It provides a sleek drag-and-drop web interface. Just select your fields to render instant graphs.

Real-Time Data

Charts connects to your live operational data. Your dashboards update as data flows into the database. There is no need for slow ETL extraction pipelines.

Embedding Charts

Once a chart is built, you can share it. Atlas provides an Embedding SDK for the web. You can embed graphs directly into your HTML applications.

Embedding SDK Example:

import ChartsEmbedSDK from '@mongodb-js/charts-embed-dom';

const sdk = new ChartsEmbedSDK({ baseUrl: 'https://charts.mongodb.com/charts-app-id' });

const chart = sdk.createChart({ chartId: 'chart-uuid-here' });

// Render the live chart inside an HTML div chart.render(document.getElementById('chart-container'));

Supported Chart Types

MongoDB Charts supports numerous visual types. You can build bar charts, line graphs, and pie charts. It also supports geospatial map plots for location data.

Security and Filters

Embedded charts are highly secure. You can pass runtime filters in your code. This ensures a user only sees their own respective data.

Summary

MongoDB Charts is a powerful, code-free analytics tool. It connects directly to live BSON data streams. You can embed interactive visualizations safely into any website.

Exercise

Do you need to export your data to a SQL database before using MongoDB Charts?