mongodb - mongoimport with CSV: --headerline does not convert first row to fields -


when try import .csv file (non-existent) mongodb collection, first line not correctly converted fields.

instead, 1 new field field names in it. in field, data stored.

example csv:

product;type apple;fruit pizza;italian coffee;drink 

the command use:

mongoimport -d db -c collection --type csv --headerline --file ./import.csv 

the result 1 row:

{     "_id": objectid("56a89c5f3ea2a256f0da7acf"),     "product;type": "coffee;drink" } 

does know whats wrong here?

csv stands coma-separated values: https://docs.mongodb.org/manual/reference/glossary/#term-csv

not semicolon-separated ones. preprocess import.csv

sed -import.bak "s/;/,/g" import.csv 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -