mongoimport csv headerline

275 views
Skip to first unread message

casagra...@gmail.com

unread,
Nov 25, 2013, 10:34:00 AM11/25/13
to mongod...@googlegroups.com
Hello !

I'm new in the magic world of mongo, node & angularjs...And i love it !

I just have a little question : 

I have a csv file with a header in the first line and i import it on my mongodb

mongoimport --db lfptest --collection csvtest --type csv --file csv1.csv --headerline


input add correctly.

but when i look to my json output

db.csvtest.find()

it seems that i have only two fields and all my headers are in the first key and all my values are in the first val :
{ "_id" : ObjectId("5293623d6525a9c3ae5462a8"),"header1;header2;header3;header4" :"value1;value2;value3;value4"}


But i'd have something like this :
{ "_id" : ObjectId("5293623d6525a9c3ae5462a8"),"header1":"value1,"header2":"value2","header3":"value3","header4":"value4"}


i try to remove the first line of my csv and use the --fields parameter on the mongoimport but i've got some errors (command not found)

What i'm doing wrong ??
Can someone explain me how to do that, he would be my hero !!!


Best regards,



casagra...@gmail.com

unread,
Nov 25, 2013, 11:08:21 AM11/25/13
to mongod...@googlegroups.com
EDIT :

Problem solved...
It was a csv issue. 
I replace all the separator ";" by "," and it works perfectly !!

love mongo !
 
Reply all
Reply to author
Forward
0 new messages