Migrate database from MongoDB Atlas to your server

MongoDB Atlas is a hosted MongoDB server hosting in cloud. If you are starting with MongoDB, they have free hosting, that work for smaller sites.

https://www.mongodb.com/cloud

MongoDB Atlas

On this page, you can see the version of MongoDB is Version 4.2.10. You need to install same or newer version of MongoDB on your server.

MongoDB documentation have detailed instructions for installing MongoDB on various Operating systems.

https://docs.mongodb.com/manual/administration/install-on-linux/

Take MongoDB backup

MongoDB atlas provide you command to take backup. On “Clusters” page, click the 3 dots, then select command line tools. Next page will show you command to take backup of your MongoDB database.

You can find database name in atlas, for this, click “Cluster0”, then go to Collections tab. You will see database name on this page.

Once you run the mongodump command, it will create a folder “dump” and save backup inside.

backup mongodb database using mongodump

Restart MongoDB backup

To restart MongoDB backup locally, run

USER_NAME_HERE and PW_HERE is MongoDB user and password. You can enable MongoDB authentication following instructions at

https://docs.mongodb.com/guides/server/auth/

Update Application to use local MongoDB

The application used following connection string

I replaced it with

Leave a Reply

Your email address will not be published. Required fields are marked *