Export a mongo collection as csv
![Export a mongo collection as csv](https://res.cloudinary.com/audiodog/image/upload/w_640,h_155,c_scale,f_auto,q_auto/v1513806711/images/site/blog_banner_light.png)
Started to create a script to do this, then realised mongoexport can do this out of the box!
# Note the field names required cannot have any spaces between them # Note -q is optional. note any $ need escaping, plus other shell sensitive characters mongoexport --host localhost --db --collection -f name,app_contact_name,app_contact_email -q <json query> --csv > test.csv