Importing and Exporting MongoDB

Export your local MongoDB to the file system:

mongodump --uri="mongodb://root:password@127.0.0.1:27017/?authSource=admin&readPreference=primary&directConnection=true&ssl=false" --db "my-contentengine" --out /home/username/Documents/mongodump

Import a database folder back into your Mongo Database:

To change the target database rename the folder in the mongodump folder to the same as the database you will be inporting to then run this:

mongorestore --uri="mongodb://root:password@127.0.0.1:27017/?authSource=admin&readPreference=primary&directConnection=true&ssl=false" /home/username/Documents/mongodump