Last active
August 29, 2015 14:07
-
-
Save montanaflynn/42222dd1097e95367d58 to your computer and use it in GitHub Desktop.
MongoDB CSV export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mongo export all users who have an email and are not hellbanned | |
# take special notice that --query is in quotes and is valid JSON | |
# also that --fields is also wrapped with quotes and is comma seperated | |
mongoexport --db appname --collection users \ | |
--query '{ "$and" : [ { "email" : { "$ne" : "" } }, { "role" : { "$ne" : 666 } } ] }' \ | |
--csv --fields 'username, email' --out ./user-emails.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment