Docs Menu
Docs Home
/
MongoDB Compass
/

Export Aggregation Pipeline Results

On this page

  • About this Task
  • Steps
  • Learn More

To use your aggregated data in other external tools, you can export your pipeline results from MongoDB Compass as a JSON or CSV file.

Avoid using CSV files exports to back up your data. CSV files may lose type information and are not suitable for backing up your data.

1

In the top right of the aggregation pipeline builder, click the Export button to open the modal.

Export button on aggregation pipeline
2

Under Export File Type, select either JSON or CSV. If you select JSON, your data is exported to the target file as an array of JSON objects.

3

If choose to export your data as a JSON file, you can expand the Advanced JSON Format drop-down menu and select from the following extended JSON formats:

JSON Format
Description
Sample Document
Default Extended JSON
A string format that avoids any loss of BSON type information. This is the default Compass setting.
{
"fortyTwo" : 42,
"oneHalf" : 0.5,
"bignumber" : {
"$numberLong" : "5000000000"
}
}
Relaxed Extended JSON

A string format that emphasizes readability and interoperability at the expense of type preservation. That is, conversion from relaxed format to BSON can lose type information.

WARNING: This format is not recommended for data integrity.

{
"fortyTwo" : 42,
"oneHalf": 0.5,
"bignumber" : 5000000000
}
Canonical Extended JSON
A string format that emphasizes type preservation at the expense of readability and interoperability. That is, conversion from canonical to BSON will generally preserve type information except in certain specific cases.
{
"fortyTwo" : {
"$numberInt" : "42"
},
"oneHalf" : {
"$numberDouble" : "0.5"
},
"bignumber" : {
"$numberLong" : "5000000000"
}
}
4
5

In the new pop-up modal, enter a name for your export file, specify the file destination, and click Select to export your pipeline results.

  • Export Data from a Collection

  • Export Pipeline to Specific Language

Back

Set Max Time MS