Search code examples
mongodbaggregation-frameworkmongodb-compass

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.


Solution

  • 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