How to import collection from MongoDB to mLab?

How to import collection from MongoDB to mLab?
0

#1

Title says it all, I would like to import my collection from my local db to the cloud, I’ve tried reading the documentation but it’s not very clear as in which folder I’m supposed to run the commands in the terminal.

Also, can I connect my db to the cloud in my node app?, if so, how?


#2

I was able to do it, I’m going to leave the solution here as a reference in case someone needs help with this

mongoimport -h ds012345.mlab.com:56789 -d dbname -c collectionname -u dbuser -p dbpassword --file filename.json