How to pass aggregation pipeline query (javascript file) to mongoexport

435 Views Asked by At

I need to export data from mongodb into csv file. The query is an aggregation pipeline and it is stored in js file. How do I pass this complex query as input to mongoexport.

Thanks for your help in advance.

1

There are 1 best solutions below

3
On

You have to write the query in js file and load it. Check this out https://dasbotask.com/mongodb-export-mongoexport-using-aggregation/