What does “too many positional options” mean when doing a mongoexport?

后端 未结 14 1654
暖寄归人
暖寄归人 2020-12-05 09:27

mongoexport -h db.mysite.com -u myUser -p myPass -c myCollection

But the response I get is:

ERROR: too many positional options

相关标签:
14条回答
  • 2020-12-05 10:00

    Create a json file in the same folder where you have your mongod.exe.

    eg: coll.json

    and open a command prompt in this folder.

    type this below in CMD.

    mongoexport --db databasename --collection collectionname --out coll.json

    and you will see like a progress bar very cool exporting all data.

    0 讨论(0)
  • 2020-12-05 10:01

    I had the same issue with the mongoexport utility (using 2.0.2). My fix was to use the FULL parameter name (i.e. not -d, instead use --db).

    0 讨论(0)
  • 2020-12-05 10:01

    Sometimes editor will screw it up (such as evernote). I fixed the issue by retyping the command in terminal.

    0 讨论(0)
  • 2020-12-05 10:01

    I was also stuck in same situation and found what was causing it.

    1. Make sure you are exporting in CSV format by adding parameter --type csv
    2. Make sure there are no spaces in fields name, Example: --fields _id, desc is wrong but --fields id,desc,price is good
    0 讨论(0)
  • 2020-12-05 10:04

    The same error I have encountered while importing a csv file. But its just, the fact that the field list which you pass for that csv file import may have blank spaces. Just clear the blank spaces in field list.

    Its the parsing error.

    0 讨论(0)
  • 2020-12-05 10:04

    I had the same issue with starting mongod. I used the following command:

    ./mongod --port 27001 --replSet abc -- dbpath /Users/seanfoley/Downloads/mongodb-osx-x86_64-3.4.3/bin/1 --logpath /Users/seanfoley/Downloads/mongodb-osx-x86_64-3.4.3/log.1 --logappend --oplogSize 5 --smallfiles --fork

    The following error message appeared:

    Error parsing command line: too many positional options have been specified on the command line

    What fixed this issue was removing the single space between the '--' and 'dbpath'

    0 讨论(0)
提交回复
热议问题