Skip to content

Instantly share code, notes, and snippets.

@makmac213
Created May 27, 2016 07:24
Show Gist options
  • Save makmac213/e92a7ad25211adfecbd9a2fbd812a646 to your computer and use it in GitHub Desktop.
Save makmac213/e92a7ad25211adfecbd9a2fbd812a646 to your computer and use it in GitHub Desktop.
# export script
# export_script.js
print("subject,sender,recipient,created")
db.collectionname.find({'subject':/for you/}).foreach(function(email){
print(email.subject+","+email.sender+","+email.recipient+","+email.created);
});
# then run this line
$ mongo tablename export_script.js > export_file.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment