How do you export all the records in a MongoDB collection to a .csv file?
.csv
mongoexport --host localhost --db dbname --collection name --type=csv
Below command used to export collection to CSV format.
Note: naag is database, employee1_json is a collection.
naag
employee1_json
mongoexport --db naag--collection employee1_json --type csv --out /home/orienit/work/mongodb/employee1_csv_op1