Back to: MongoDB Tutorials
How to Install MongoImport and MongoExport
In this article, I am going to discuss How to Install MongoImport and MongoExport. Please read our previous article where we discussed How to work with MongoDB Database i.e. how to Show, Create, and Drop MongoDB Database.
How to Install MongoImport and MongoExport
MongoDB provides special tools to import/export data in/from MongoDB and the tools are MongoImport and MongoExport. In this article, I will show you how to install MongoImport and MongoExport tools.
What is MongoImport?
The MongoImport tool is used to import data in the MongoDB Database. With the help of MongoImport, we can import files like JSON, CSV, TSV, etc. into the MongoDB Database.
What is MongoExport?
The MongoExport tool is used to export data from the MongoDB database so that other applications can also use that data. With the help of MongoExport, we can import files like JSON, CSV, etc. from the MongoDB Database.
In earlier versions, MongoImport and MongoExport are available with MongoDB Server. But now they are available separately so you can download them according to your requirements.
Note: Always remember that MongoImport and MongoExport do not run in Mongo Shell. You can directly use them in command prompt (Windows) or terminal (macOS).
Installing MongoImport and MongoExport
Following are the steps to install MongoImport and MongoExport:
Step 1: Open the browser and go the like: https://www.mongodb.com/try/download/database-tools2
Step 2: Go to “MongoDB Command Line Database Tools Download”.
Now you can choose the version, platform, and package. Here I choose version: 100.6.0, platform: macOS, Package: zip.
Step 3: After downloading unzip the file.
Step 4: Now go to the bin folder of the unzipped file and copy all the .exe files.
Step 5: Paste all the copied .exe files into the MongoDB bin folder.
So, we get all the files in the MongoDB folder:
Step 6: Open a terminal and run the MongoDB server.
Step 7: Open another terminal and run mongoshell.
Step 8: Open one more terminal and run the following command to check MongoImport is successfully installed by checking its version- mongoimport –version
Step 9: Run the following command to check MongoExport is successfully installed by checking its version- mongoexport –version
Note: In Mac, you can directly access them but in windows OS, you have to redirect to the MongoDB bin folder. Now you are ready to use MongoImport and MongoExport.
In the next article, I am going to discuss How to Perform CRUD Operations in MongoDB with Examples. In this article, I try to explain How to Install MongoImport and MongoExport. I hope you enjoy this How to Install MongoImport and MongoExport article.
About the Author:
Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.