Question

SCP file transfer with mongo db

Posted June 5, 2018 1.2k views
MongoDBUbuntu 16.04

I have an app running on localhost:8080 and I have scp transferred my MongoDB dumped database to my ubuntu server and placed the dir in /var/lib/mongodb file.

My questions are:

Do I have to run mongorestore on this dir?

Also, after binding my droplet IP address what is the uri for mongo supposed to be? mongo//:<droplet ip/>:27017?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, @Pappie

In order to restore the Mongo database you need to use the mongorestore command, that is correct.

The command will essentially look like this:

sudo mongorestore --db newdb /var/lib/mongodb

You can also check this tutorial for more detailed instructions:

https://www.digitalocean.com/community/tutorials/how-to-back-up-restore-and-migrate-a-mongodb-database-on-ubuntu-14-04

Hope this helps,

Regards,
Alex

by Anatoliy Dimitrov
MongoDB is one of the most popular NoSQL database engines. It is famous for being scalable, powerful, reliable and easy to use. In this article we'll show you how to back up, restore, and migrate your MongoDB databases.
Submit an Answer