How to export data from mongoDB

# Make sure that we have mongoD process running and file below command from bash and not from Mongo shell to export data. This will export data for one collection in Db, to export entire DB use mongo dump

MQ428GG8WL:week2 asee2278$ mongoexport –db students –collection grades –out gradesOut.json

  • 2016-01-14T14:21:18.813-0600 connected to: localhost
  • 2016-01-14T14:21:18.831-0600 exported 800 record

Sample exported record would look like :

{"_id":{"$oid":"50906d7fa3c412bb040eb583"},"score":92.6244233936537,"student_id":3,"type":"exam"}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s