Sometimes you might want to export your Mongodb database in
csv format. If you have many collections, it can be a bit of a hassle since mongoexport requires you to specify each field you want to be exported with the
--fields attribute and you have to do it for each collection seperately.
Here’s a little bash script that will do the work for you.
Result is a
.csv file for each collection you have in your db.