Created
February 8, 2017 05:48
-
-
Save rjollet/21f98f4659c8190eeed4b2c6a8b468fb to your computer and use it in GitHub Desktop.
export mongo to csv file
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 <host>/<dbname> -u <username> -p <password> export.js > out.csv | |
// mongo local --quiet export.js > out.csv | |
print("id, in_reply_to_status_id, user_id"); | |
db.sample_stream.find({}, { 'tweet.id_str': 1, 'tweet.in_reply_to_status_id_str': 1 , 'tweet.user.id_str': 1, _id: 0}).forEach(function(doc){ | |
print(doc.tweet.id_str + "," + doc.tweet.in_reply_to_status_id_str + "," + doc.tweet.user.id_str); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment