How to import a CSV file with a field having leading zero values into MongoDB?

240 views Asked by At

MongoDB seems to have trouble importing data, I tried to import csv file with values having leading zeros enclosed in double quotes but once imported the leading zeros gets removed.

Sample CSV File

duns_number,company_name,type,country,original_company_name,search_key,cik,last_scraped_date
"194946757","Carbonite, Inc.",Public,United States,,,"0001340127",
"116670284",SolarWinds Corp,Public,United States,SolarWinds Corporation,,"0001739942",

Sample Import Script

mongoimport --type csv -d ds_dnb -c ds_company_masterlist  --headerline --drop ""

Is there any other way of forcing it to just import the data as all text?

0

There are 0 answers