Search code examples
mongodbmongoimport

mongoimport "unknown option headerline"


I am just starting with MongoDB and have to import a csv-file. As this file has a headerline with the titles, I want to use the headerline-option. But no matter what I try, it always says "unknown option".

mongoimport -d psdat -c data --type csv --file C:\programming\csv\sample.csv --headerline;

2017-08-09T12:48:25.560+0200    error parsing command line options: unknown option "headerline;"
2017-08-09T12:48:25.587+0200    try 'mongoimport --help' for more information
  • MongoDB shell version v3.4.7
  • MongoDB server version: 3.4.7
  • running on Win10 64-bit

Does anybody know the solution to my problem or have any idea?

Thanks in advance


Solution

  • It seems as if you are running on Windows from a Windows command prompt session, and that in that environment ; is being appended to --headerline which is causes mongoimport to not recognize --headerline.

    You might be working from a copy-and-paste from a linux example where the shell will usually remove the ; before mongoimport sees it. As Neil Lunn says, just get rid of the ; character.