Question

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","20781@adventure-works.com"

How can i give field names to mongoimport?

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top