0 votes
1 view
in Web Technology by (47.8k points)

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?

1 Answer

0 votes
by (107k points)

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

Related questions

0 votes
1 answer
asked Sep 6, 2019 in SQL by Sammy (47.8k points)
0 votes
2 answers
0 votes
3 answers
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...