Phil Wills
unread,Jul 9, 2010, 12:50:35 PM7/9/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
I'm currently trying to import a csv into mongodb and hitting a rather
nasty hurdle. This csv includes some fields which can span multiple
lines of text. These are all surrounded by double-quote text
delimiters, which OpenOffice for instance understand fine, but
mongoimport starts a new element for each newline, even when they're
within the quotes. I can't find anything with --help to specify a
delimiter. Is there a way to achieve this?
To give a concrete example, given the file multiline.csv which
contains:
first-field, second-field, third-field
"First field","Second field first line
Second field second line","Third field"
then when I run
mongoimport -d multiline -c test --type csv --file multiline.csv --
headerline --drop --ignoreBlanks
then I end up with:
{ "_id" : ObjectId("4c37522653a73e76eb45b21d"), "first-field" : "First
field", "second-field" : "Second field first line" }
{ "_id" : ObjectId("4c37522653a73e76eb45b21e"), "first-field" :
"Second field second line\"", "second-field" : "Third field" }
whereas I would hope for:
{ "_id" : ObjectId("4c37522653a73e76eb45b21d"), "first-field" : "First
field", "second-field" : "Second field first line
Second field second line", "third-field": "Third field"}
Thanks,
Phil Wills