How to export mlab online database to file
Asked Answered
E

1

7

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.

Eggplant answered 31/3, 2018 at 9:43 Comment(0)
M
13

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>
Midshipman answered 1/4, 2018 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.