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

后端 未结 14 1656
暖寄归人
暖寄归人 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:11

    Had a similar issue

    $too many positional arguments
    $try 'mongorestore --help' for more information
    

    Simply fix for me was to wrap the path location in quotes " "

    This Failed:

    mongorestore -h MY.mlab.com:MYPORT -d MYDBNAME -u ADMIN -p PASSWORD C:\Here\There\And\Back\Again
    

    This Worked:

    mongorestore -h MY.mlab.com:MYPORT -d MYDBNAME -u ADMIN -p PASSWORD "C:\Here\There\And\Back\Again"
    
    0 讨论(0)
  • 2020-12-05 10:13

    I had this same problem. In my case, I was using mongoexport with the --query option, which expects a JSON document, such as:

    mongoexport ... --query {field: 'value'} ...
    

    I needed to surround the document with quotes:

    mongoexport ... --query "{field: 'value'}" ...
    
    0 讨论(0)
  • for the (Error: Too many arguments)

    Dont Use Space Between the Fields

    try:

    mongoexport --host localhost --db local --collection epfo_input --type=csv --out epfo_input.csv --fields cin,name,search_string,EstablishmentID,EstablishmentName,Address,officeName
    

    Dont_Try:

    mongoexport --host localhost --db local --collection epfo_input --type=csv --out epfo_input.csv --fields cin,name,search_string,Establishment ID,Establishment Name,Address,office Name
    
    0 讨论(0)
  • 2020-12-05 10:17

    I had the same issue with mongodump. After searching a bit, I found out that using the --out parameter to specify the output directory would solve this issue. The syntax for using the out parameter is

    mongoexport --collection collection --out collection.json
    

    Also in case your Mongodb instance isn't running, then you could use the --dbpath to specify the exact path to the files of your instance.

    Source: http://docs.mongodb.org/manual/core/import-export/

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

    I had the same issue while using the "mongod --dbpath" command. What I was doing looked somewhat like this:

    mongod --dbpath c:/Users/HP/Desktop/Mongo_Data

    where as the command syntax was supposed to be:

    mongod --dbpath=c:/Users/HP/Desktop/Mongo_Data
    

    This worked for me. Apart from this one may take a note of the command function and syntaxes using the mongod --help command.

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

    I had the same problem. Found a group post somewhere which said to remove the space between the '-p' and the password, which worked for me.

    Your sample command should be:

    mongoexport -h db.mysite.com -u myUser -pmyPass -c myCollection
    
    0 讨论(0)
提交回复
热议问题