# MysqL导出tsv格式文件
MysqL -hlocalhost -uUSER -pPASSWORD -e "select id,name,age,sex from DB_NAME.users where age>10 into outfile '/tmp/xxxx.tsv' fields terminated by '\t' optionally enclosed by '' escaped by '' lines terminated by '\r\n';"
#mongoimport 把tsv文件数据导入mongodb
mongoimport -h localhost -u USER -p PASSWORD -d DB_NAME -c user_collection --columnsHaveTypes --type tsv --file '/tmp/xxxx.tsv' -f id.int\(\),name.string\(\),age.int\(\),sex.int\(\),created_date.date_ms\('yyyy-MM-dd H:mm:ss'\)
原文链接:https://www.f2er.com/bash/390186.html