How do you export all the records in a MongoDB collection to a .csv file?
mongoexport --host localhost --db dbname --collection name --type=csv > test.csv
This asks me to specify the name of the fields I need to export. Can I just export all the fields without specifying the names of fields?
To export collection to CSV in MongoDB you are not allowed spaces between comma separated field names.
The bad way is: -f firstname, lastname
The good way would be: -f firstname,lastname