Search code examples
mongodbmongodb-shell

How can I copy a db mongo to another mongodb instance?


I want to copy my db called users binded by default to localhost:27017 to another bind address. How can I do this?


Solution

    1. You could try using this copydb command.

    2. Otherwise, you could use mongo export, export the data to a file. Then import those data into the new database. Back Up and Restore with MongoDB Tools

      Here is the doc of mongo export mongoexport