When importing CSV / TSV into mongodb, the option --columnsHaveTypes can help determine the types of columns. But the document seems very obscure. I tried several times until it finally worked out. You must add the --columnsHaveTypes option and change each column after --fields and remember to use the "\" before the "(" and ")". for example, change:
mongoimport -h foohost -d bardb -c fooc --type tsv --fields col1,col2,col3 --file path/to/file.txt
in
mongoimport -h foohost -d bardb -c fooc --type tsv --fields col1.int32\(\),col2.double\(\),col3.string\(\) --columnsHaveTypes --file path/to/file.txt
source share