Search code examples
mongodbmongoimport

MongoDB import error assertion 9998


I seem to keep having this error when i try and import anything?

In terminal I input:

name:~ computer$ mongoimport --db users --collection contacts --type csv --file /Users/computer/Desktop/ftse100.csv
connected to: 127.0.0.1
assertion: 9998 you need to specify fields

I wouldn't know what to ask. I tried adding --field after this command line but just get help information.

ER


Solution

  • As per mongodb docs

     --fields <field1[,field2]>, -f
    

    Specify a comma separated list of field names when importing csv or tsv files that do not have field names in the first (i.e. header) line of the file.

    mongoimport --db users --collection contacts --type csv --file /Users/computer/Desktop/ftse100.csv --fields field1, field2,field3
    

    As per your question, there is a typo it's not --field instead --fields