MongoDB Data Migration to Atlas

Preconditions

Step 00: CSV data to local MongoDB (Optional)

Local Monogo DB initial (Runing on a Docker listening on port 27018)

Step 01: Creating the Cluster on MongoDB Atlas

Step 02: Data Dump from tocal and Restore in Atlas

$ mongodump --port 27018 --db viedma-r0
$ mongorestore --uri mongodb+srv://<db-user>:<db-pass>@cluster0.cccll.mongodb.net
Mongo Restore (I)
Mongo Restore (Cont)

Step 03: Very it from Compass

Step 04: Using Other GUI like Robo 3T

Configuration Connection from Robo 3T to mongo DB in Atlas

Step 05: Connect the Node JS Backend

mongodb+srv://<user>:<pass>@MyCluster0.nnnnn.mongodb.net/myDatabase?retryWrites=true&w=majority

Source Code:

/*URI like (from .env variables):mongodb+srv://<user>:<pass>@MyCluster0.nnnnn.mongodb.net/myDatabase?retryWrites=true&w=majority*/const atlas_uri = process.env.GlaciaR_Viedma_backend__MONGODB_ATLAS_URI;console.log(‘getMongoConfig(Atlas MongoDB)= ‘, atlas_uri); if (atlas_uri) { 
return atlas_uri
}
var mongoose = require('mongoose').set('debug', true)
mongoose.connect(Global.getMongoConfig(), function(err, res) {
if(err) {
console.log('Error connecting to the database. ' + err);
} else {
console.log('Connected to Database ... ');
}
});

Backend:

Backend API with Raw Data
Backend Data From Mongo DB in Atlas

Front End: glaciar.org

Final Words

Resources

--

--

--

#cloud . #mobile ~} Sharing IT while learning It! ... Opinions are for my own

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top Flight API To Get Flight Data Of Flybe Airlines

Use An API To Obtain Platinum Prices In Bangladeshi Taka

Working with Python Files I/O

How To Use Woord’s SSML Editor

Generating Automated Feedback of Product Review Videos Using Python

Tips on buying erhu strings(二胡弦選購指南)

Understanding Uncomplicated Firewalls (UFW) in Ubuntu

Everything Linux: Table of Contents & A Few Words

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pablo Ezequiel Inchausti

Pablo Ezequiel Inchausti

#cloud . #mobile ~} Sharing IT while learning It! ... Opinions are for my own

More from Medium

M_STORE — An e-commerce site for my ALX/Holberton portfolio project

Transferring data from MySQL to MsSQL DataBase

A Simple Introduction to Stack Data Structures

Sharp Notes to SQL Users Migrating to DynamoDB