Import and Export database in Mongo just like MySQL
-
I am newbie to the Mongo.Before this I have worked only with MySQL.In MySQL we can import and export database easily.I want to know is there any option available in Mongo to import and export database easily.Any help and suggestions will be highly appreciable.
-
Answer:
If you look inside mongodb/bin folder (ls -l) You can find a couple of binaries. The mongoDB has import and export tools. If you're running mongod locally on the default port, you can just do: $ ./mongodump Example: Dumping Everything $ ./mongodump --host prod.example.com Example: Dumping a Single Collection $ ./mongodump --db blog --collection posts Others like http://www.mongodb.org/display/DOCS/mongoexport, mongoimport, mongorestore, bsondump etc. for more http://www.mongodb.org/display/DOCS/Import+Export+Tools
newuser at Database Administrators Visit the source
Other answers
You can use something like this to export: mongodump -h yourhost -d yourdbname And to import, just run: mongorestore It is important to remember that mongorestore just insert new documents, but does not update or delete the old ones. If you want to discard your database, you need to use the --drop: mongorestore --drop This is how I export and import databases like MySQL. You can learn more about mongodump and mongorestore here: http://docs.mongodb.org/manual/reference/mongodump/ http://docs.mongodb.org/manual/reference/mongorestore/
Vinicius Munhoz
Related Q & A:
- where is the index physically located in MySQL database?Best solution by Database Administrators
- How to store an image in database using MySQL?Best solution by stackoverflow.com
- How to manage MySQL database in Azure?Best solution by stackoverflow.com
- Is there any GED school online that just like cyber school?Best solution by Yahoo! Answers
- Is there any other site just like Stagevu?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.