Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export aggregated data using MongoDB Compass

Can we export aggregated data from MongoDB compass 'Aggregation' section after applying the last stage of aggregation? Like we can do it easily using 'export data' option under 'Documents' section and we get options to export it as JSON and CSV. I only see options to export the aggregation code from left side.

like image 424
Priyanka S Avatar asked Apr 30 '21 08:04

Priyanka S


People also ask

Can I export database from MongoDB compass?

You can use MongoDB Compass to import and export data to and from collections. Compass supports import and export for both JSON and CSV files.

Is MongoDB good for aggregate?

As with many other database systems, MongoDB allows you to perform a variety of aggregation operations. These allow you to process data records in a variety of ways, such as grouping data, sorting data into a specific order, or restructuring returned documents, as well as filtering data as one might with a query.


1 Answers

I think the best way is to use the dedicated feature export data (next to "add data" button)

enter image description here

And write here your own query :

enter image description here

Or save the result of all your stage as a view (it creates a new collection with your results) and export the data (as previous pictures): enter image description here

like image 79
TheTatane Avatar answered Sep 17 '22 06:09

TheTatane