This documentation refers to the on-premises edition of MongoDB Charts. Read the Atlas service documentation to learn how to use MongoDB Charts with your Atlas project.

Encoding Channels

Encoding channels are the building blocks of your visualizations. These channels are the means by which Charts translates data from your collection to the visualization. The encoding process dictates how that data appears in the chart based on the channel type selected.

Encoding Channel Types

Each encoding channel type provides different capabilities for processing and visualizing your data. Each channel type accepts distinct data types (e.g., string versus numeric data). The following table describes each encoding channel type in MongoDB Charts:

Encoding Channel Type Description
Value A point on the chart is created from the chosen field for each document in the collection. You may only assign fields with a numeric or date type to a Value channel.

Each unique value from this field in the collection is used as a chart category. The Category encoding channel provides the following additional visualization options:

  • For fields with a string data type, you can specify a field to sort on and the sort order.
  • For fields with a numeric data type, you can toggle data binning and select the bin size.
  • For fields with a date data type, you can toggle date grouping and select the grouping period.
Aggregation A point on the chart is created by applying an aggregation function over the values of this field from multiple documents. For more information on aggregation in Charts, see the Aggregation section.

When you create a chart using a geopoint channel type, MongoDB Charts renders a map to visualize your data. A mark is plotted on the map for each document containing the selected field based on the field’s latitude and longitude values. Geopoint channel types are used in the Coordinates channel on Geospatial Scatter and Geospatial Heatmap chart types.

For more information on the geopoint encoding channel type, refer to the Geopoint Channel Type section.

Charts shows required encoding channels in green, and optional encoding channels in blue.


Dragging a field onto an aggregation encoding channel allows you to use an aggregation pipeline operator on that field. The aggregation operators available in the chart builder change based on the data type of the selected field. MongoDB Charts categorizes the field data type as either a number, string, or date and displays appropriate aggregation options accordingly.


Donut charts provide two encoding channels:

  • A category channel called Label dictating which field to use when dividing the sections of the chart.
  • An aggregation channel called Arc dictating the aggregation operation to perform on the Label category.

The following donut chart examines NASA’s Landslide data source to show the frequency of various landslide triggers by performing a $count aggregation on the trigger field:

Donut chart example

We see from the chart that the most common landslide trigger is Downpour followed by Rain.

Geopoint Channel Type

Geopoint channel types are used in the Coordinates channel on Geospatial Scatter and Geospatial Heatmap chart types. Geospatial charts visualize data that references specific geographic locations.

MongoDB Charts automatically determines which fields in your dataset, if any, are GeoJSON Points. Charts signifies these fields with a geoglobe icon icon. You can map these fields directly to a geopoint channel type by dragging them onto an appropriate geopoint channel type in the chart builder. Charts automatically determines the latitude and longitude values from the field and adds a point to the map for each document.


You can also assign numeric coordinates or arrays to a geopoint channel type to specify latitude and longitude not stored as GeoJSON Points. For details on this process, see the following section.

Assign Non-GeoJSON Fields to a Geopoint Channel Type

This section describes how to use fields not stored as GeoJSON Points in a geopoint channel type.

  • You can drag numeric fields onto a geopoint channel type to specify latitude and longitude. When you drag a numeric field onto a geopoint channel type, the channel updates to use the selected field as either Latitude or Longitude. Charts prompts you for a second numeric field to fill in the other value.
  • Alternatively, you can drag a numeric array onto a geopoint channel type to specify location coordinates from a field. When you use this approach, you can specify which indexes of the array to use for latitude and longitude components.

For additional information and examples on Geospatial Scatter and Heatmap charts which utilize geopoint channel types, refer to the relevant chart type pages.

Surface Missing Fields in the Chart Builder

MongoDB Charts populates the Fields pane of the chart builder by randomly sampling documents from the selected data source. As a result, Charts may not display all fields from documents in the data source if the field is not present on all documents.

To surface a specific field in the chart builder, you can use the Query Bar to define certain fields which must appear in the sampled documents.


The following MQL query, when executed in the query bar, ensures that the customer_satisfaction field is included in the Fields pane.

{ "customer_satisfaction": { $exists: true } }

This query guarantees that you can interact with the customer_satisfaction field and include the field in chart construction.