mongoimport how to determine field names

4.2k views Asked by At

i have a .csv file that holds person datas.A line for a person like this.

"20781","IN","Ms.","Roy","","Serrano","2002-04-16 00:00:00","[email protected]"

How can i give field names to mongoimport?

Field names -> id,type,firstname,middlename,lastname,modifieddate,e-mail.

1

There are 1 answers

1
nish71 On BEST ANSWER

you can do like Bellow

mongoimport -d test -c person -type csv --file person.csv --fields "id,type,firstname,middlename,lastname,modifieddate,e-mail"

this will import your file as in one document.