Monday, May 14, 2012

MongoDB dump Export and restore


Export:
#  mongodb/bin location
                    mongodump -o dumpFolder
 
 Import:
mongorestore  dumpFolder dbpath  /mongodb_db_path 

2 comments:

  1. Hi Prithivi ,

    How this is different for mongoimport and mongoexport commands , any idea which should be used ?

    ReplyDelete
  2. Hi Ajay,

    mongoimport and mongoexport requires JSON or CSV data.During execution It read string per line from the Input file and inserts it.

    Whereas mongodump and mongorestore command use binary data(.bson file). It will have all collection and system indexes.This we can use for taking/applying hot backups of a database.

    ReplyDelete