Mongodb monogoimport.exe如何跳过csv中的第一列和标题行?

Mongodb monogoimport.exe如何跳过csv中的第一列和标题行?,mongodb,csv,mongoimport,Mongodb,Csv,Mongoimport,我需要将csv文件导入mongoDB。 csv文件包含3列,但我只想导入2列,并跳过第一列和标题行 如果我有: id, firstName, lastName 1, Joe, Williams 如何仅导入firstName和lastName列并跳过id列和headers行? 我不想更改csv本身。 我正在使用脚本进行导入: "...\mongoimport.exe" --host __ --username __ --authenticationDatabase ___ --pas

我需要将csv文件导入mongoDB。
csv文件包含3列,但我只想导入2列,并跳过第一列和标题行

如果我有:

id, firstName, lastName  
1, Joe,  Williams
如何仅导入firstName和lastName列并跳过id列和headers行? 我不想更改csv本身。
我正在使用脚本进行导入:

"...\mongoimport.exe" --host  __  --username __  --authenticationDatabase ___ --password __ --db __ --collection __--headerline --file MyCsv.csv --type csv --maintainInsertionOrder
谢谢

您可以使用

 mongoimport /fields:firstName, lastName    ///***/// add your optons here
mongoimport.exe--帮助

输入选项:
/f、 /fields:[,]*以逗号分隔的字段列表
姓名,例如-f姓名、年龄
/fieldFile:具有字段名的文件-每个字段1个
线
/文件:要从中导入的文件;如果不是
如果指定,则使用标准DIN
/标题行使用输入中的第一行
源作为字段列表(CSV
(仅限TSV)
/jsonArray将输入源视为JSON
排列
/类型:要导入的输入格式:json,
csv或tsv(默认为
‘json’)

感谢您的重播。我也可以跳过标题行吗?@Shir no,因为mongo需要将字段名与值匹配
input options:
  /f, /fields:<field>[,<field>]*                  comma separated list of field
                                                  names, e.g. -f name,age
      /fieldFile:<filename>                       file with field names - 1 per
                                                  line
      /file:<filename>                            file to import from; if not
                                                  specified, stdin is used
      /headerline                                 use first line in input
                                                  source as the field list (CSV
                                                  and TSV only)
      /jsonArray                                  treat input source as a JSON
                                                  array
      /type:<type>                                input format to import: json,
                                                  csv, or tsv (defaults to
                                                  'json')