Export aggregated data using MongoDB Compass
Asked Answered
N

1

20

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.

Numerator answered 30/4, 2021 at 8:57 Comment(0)
W
23

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

Woodchopper answered 30/4, 2021 at 9:8 Comment(3)
Thank you but I don't think that box 'export query with filters' is editable. And as I am on aggregation section, after I have applied all the aggregation function, there is no option to export data (that is displayed after the last stage of aggregation is applied)Numerator
I just remember, you can create a view from the result of all you stage applied (with de button save -> create a view). And after export all data in the view with my previous post.Woodchopper
Yes creating a view helped reflect the aggregated functions to documents. Thank you so much! Appreciate it!Numerator

© 2022 - 2024 — McMap. All rights reserved.