Sample test dataset CSV file stored at the location c:\Users\yc03ak1\Desktop\testing.csv
_id city loc pop state
1 A [10.0, 20.0] 2222 PQE
2 B [10.1, 20.1] 22122 RW
3 C [10.2, 20.0] 255222 RWE
4 D [10.3, 20.3] 226622 SFDS
5 E [10.4, 20.0] 222122 FDS
to import this data-set to the database named "test" and collection named "sample"
C:\Users\yc03ak1>mongoimport --db test --collection "sample" --drop --type csv --headerline --host "localhost:47019" --file "c:\Users\yc03ak1\Desktop\testing.csv"
output :
2016-08-10T20:25:48.572-0700 connected to: localhost:47019
2016-08-10T20:25:48.576-0700 dropping: test.sample
2016-08-10T20:25:49.109-0700 imported 5 documents
OR
C:\Users\yc03ak1>mongoimport --db test --collection "sample" --drop --type csv --fields _id,city,loc,pop,state --host "localhost:47019" --file "c:\Users\yc03ak1\Desktop\testing.csv"
2016-08-10T20:26:48.978-0700 connected to: localhost:47019
2016-08-10T20:26:48.982-0700 dropping: test.sample
2016-08-10T20:26:49.611-0700 imported 6 documents