Friday, November 28, 2014

import data from CSV file

1.) Do the step 8 in this post.

2.) Download the .csv file from here.

3.) save it in the c://mongodb/bin

4.) and type command in the following image in another terminal
            mongoimport -d ABC -c airports --type csv --file countrylist.csv --headerline

      ABC :- database name
      airports :- Name of the document (table) where the imported data saves.
      countrylist.csv  :- file in the bin folder
  Note:-maybe you get 3 errors due to some eerors in the csv file.

5.) Now type use ABC
6.) then type db.airports.find()
7.) You will see the data in the airports document.
8.) I here you will see only few data at a time.
9.) To see other type it and press ENTER.

No comments:

Post a Comment