Import Data into MongoDB (Using CMD for Windows OS users On local Database

Step No. 1 (Download, Mongo DB Database Tools From Download MongoDB Command Line Database Tools | MongoDB) Select package - msi.

Step No. 2 ( Install all the Executable stand for (.EXE Files) Setup)

Step No. 3 ( Copy the files from (C:\Program Files\MongoDB\Tools\100\bin) only in case if your method of installed (default setup ) Some users change the MongoDB installation files location somewhere else in the system.

Step No. 4 ( Then Paste the copied files to (C:\Program Files\MongoDB\Server\5.0\bin)
be sure ( the name of the files are existed named by (1. mongoimport.exe and other files are optional required to that Scenario where you need to export some files ( example. 2. **mongoexport.exe to that case.)

Step No. 5 ( In addition if you are coping the data from Excel sheet or importing file from example.JSON then ( Copy the work file example.JSON or contents.csv files to the same path or in same location (C:\Program Files\MongoDB\Server\5.0\bin) .

Step No. 6 ( Open the command prompt (run as a administrator) type (the addressing line. Example ( cd C:\Program Files\MongoDB\Server\5.0\bin** ) .

CD Command used for ( to Change the Directory ) Means that find that file in the given location.

Step No. 7 ( mongoimport persons.json -d contactData -c contacts --jsonArray ) In my case take as example (your may different).

-d (used for creating Database) and
-c (used for the creating the collection inside the database)
–jsonArray (used to import JSON files correctly to the database.

Note: Majority of the Errors are created by the spell mistake (example created database by the name of (flights) and your typing mistakes are (filghts) please make sure to correct it.