Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Sunday, January 3, 2016

How do I create a MongoDB dump of my database?

How do I create a MongoDB dump of my database?


What command do I use and run?

Answer by James for How do I create a MongoDB dump of my database?


Use mongodump:

$ ./mongodump --host prod.example.com  connected to: prod.example.com  all dbs  DATABASE: log    to   dump/log          log.errors to dump/log/errors.bson                  713 objects          log.analytics to dump/log/analytics.bson                  234810 objects  DATABASE: blog    to    dump/blog          blog.posts to dump/log/blog.posts.bson                  59 objects  DATABASE: admin    to    dump/admin  

Source: http://www.mongodb.org/display/DOCS/Import+Export+Tools

Answer by aditya_gaur for How do I create a MongoDB dump of my database?


There is a utility called : mongodump On the mongo command line you can type :

>./mongodump  

The above will create a dump of all the databases on your localhost. To make dump of a single collection use:

./mongodump --db blog --collection posts  

Have a look at : mongodump

Answer by r03 for How do I create a MongoDB dump of my database?


You can also use gzip for taking backup of one collection and compressing the backup on the fly:

mongodump --db somedb --collection somecollection --out - | gzip > collectiondump.gz  

or with a date in the file name:

mongodump --db somedb --collection somecollection --out - | gzip > dump_`date "+%Y-%m-%d"`.gz  

Answer by jatin for How do I create a MongoDB dump of my database?


This command will make a dump of given database in json and bson format.

mongodump -d  -o   

Answer by saimadhu.polamuri for How do I create a MongoDB dump of my database?


To dump your database for backup you call this command on your terminal

mongodump --db database_name --collection collection_name  

To import your backup file to mongodb you can use the following command on your terminal

mongorestore --db database_name path_to_bson_file  


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.