I've been given a database hosted on mlab. I'm trying to download the files off of the database and onto my computer. How may I go about that? I should add I have never worked with mlab or MongoDB before. All I want to do is download the files in some format (such as JSON or CSV) and then process them with a python script I have
I saw the command mongoexport might do the trick but I couldn't figure out how to use it. Should I run on my cmd? It isn't recognized as a command on my computer, what do I need to download to fix that?
Another thing I saw is pymongo. If anyone knows how to use pymongo or python in general to export the data I would love to hear it.
Mongoexport is a tool which is installed with MongoDB. To get mongoexport, install MongoDB from this page: https://www.mongodb.com/download-center#production.
When you have MognoDB installed, open cmd and navigate to where the tools are installed (by default the location is C:\Program Files\MongoDB\Server\3.6\bin
):
cd C:\Program Files\MongoDB\Server\3.6\bin
From there you can run the export commands listed in the mLab tools tab. For example, to export to JSON:
mongoexport -h ds012345.mlab.com:12345 -d <database> -c <collection> -u <user> -p <password> -o <output file>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With