Error Too Many Positional Options Mongoexport
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more too many positional arguments mongorestore about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Boost Too Many Positional Options Have Been Specified On The Command Line
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping mongodb too many positional (i.e. '$') elements found in path each other. Join them; it only takes a minute: Sign up What does “too many positional options” mean when doing a mongoexport? up vote 26 down vote favorite 7 mongoexport -h db.mysite.com -u myUser -p myPass -c myCollection command line parse error too many positional options But the response I get is: ERROR: too many positional options What's that about? mongodb share|improve this question edited Sep 22 '11 at 21:27 Shamoon 533 asked Sep 22 '11 at 20:36 Aarvind 131123 What is the
Mongoexport Csv Too Many Positional Arguments
Jun 16 at 12:30 In general it is parsing error (some extra space or something like that), once try to "type" the command again instead of copying it from somewhere. –Khatri Sep 12 at 7:26 add a comment| 6 Answers 6 active oldest votes up vote 25 down vote 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'}" ... share|improve this answer answered Nov 8 '12 at 15:53 Dean Langford 35035 3 Some OS's work slightly differently. The above solution worked for me on Windows, but for a colleague (Mac) he had to put the single quotes (') on the outside and double quotes (") on the inside. Win: mongoexport ... --query "{field: 'value'}" ... Mac: mongoexport ... --query '{field: "value"}' ... –Ron Tuffin Sep 10 '13 at 8:18 add a comment| up vote 13 down vote 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 share|improve this answer answered Sep 29 '11 at 23:09 rowanu 891919 1 This also wor
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About positional arguments not allowed mongodump Us Learn more about Stack Overflow the company Business Learn more about hiring mongorestore too many positional options developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
Too Many Positional Arguments Pylint
Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up mongoexport query multiple field error http://stackoverflow.com/questions/7521163/what-does-too-many-positional-options-mean-when-doing-a-mongoexport (too many positional options have been specified on the command line) up vote 1 down vote favorite I am trying to mongoexport (Version 2.6) MongoDB data into csv format using the command as follows $ mongoexport --port 27017 -d test -q {userId:123 , name:'John'} -c user_datas -f userId --csv -o /myOutFile.csv and I get "Error parsing command line: too many positional options have been specified on http://stackoverflow.com/questions/34034547/mongoexport-query-multiple-field-error-too-many-positional-options-have-been-sp the command line" But if I query those two conditions separately it works fine : $ mongoexport --port 27017 -d test -q {userId:123} -c user_datas -f userId --csv -o /myOutFile.csv and $ mongoexport --port 27017 -d test -q {name:'John'} -c user_datas -f userId --csv -o /myOutFile.csv What is the problem of the first mongoexport command ? mongodb mongoexport share|improve this question edited Dec 2 '15 at 4:32 Markus W Mahlberg 7,61041934 asked Dec 2 '15 at 3:45 張軒銘 636 1 Your shell has no idea of the semantics of MongoDB. So you should quote the query string: mongoexport --port 27017 -d test -q "{userId:123 , name:'John'}"… –Markus W Mahlberg Dec 2 '15 at 4:33 Thank u @MarkusWMahlberg ! it works –張軒銘 Dec 2 '15 at 5:38 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer,
where I needed to export results of a mongo query into a CSV file. Mongoexport command comes in very handy in this case. I constructed my query: mongoexport -h https://tanyanam.com/2012/09/27/mongoexpert-error-too-many-positional-options/ myhost.mongolab.com:PORT -d mydb -u myusername -p mypassword -c coll_name -q {tag:/mytagname/,count:{$gte:10}} -f tag,tag_date,count --csv -o test.csv And when I ran it, got this error "too many positional options" Some google groups suggest that http://comments.gmane.org/gmane.comp.db.mongodb.user/25855 you need to remove the space between -p and password, but it was actually fixed in the latest version. The problem was caused by the lack quotes around my query - they need too many to be there. So the correct one looks like this: mongoexport -h myhost.mongolab.com:PORT -d mydb -u myusername -p mypassword -c coll_name -q '{tag:/mytagname/,count:{$gte:10}}' -f tag,tag_date,count --csv -o test.csv Also, "-f" values (for field names) need to be comma-separated, no spaces. Like this:Like Loading... Related Post navigation Previous Born in USSRNext Sheep in thepark 2 thoughts on “Mongoexport error: "too many positionaloptions"” Anitha Thanks. This helped a too many positional lot. Couldn't find the solution elsewhere. November 7, 2012 at 7:13 am Reply Tanya Glad to hear - thanks! November 7, 2012 at 5:59 pm Reply Leave a Reply Cancel reply Enter your comment here... Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account. (LogOut/Change) You are commenting using your Twitter account. (LogOut/Change) You are commenting using your Facebook account. (LogOut/Change) You are commenting using your Google+ account. (LogOut/Change) Cancel Connecting to %s Notify me of new comments via email. Archives October 2015 July 2015 June 2015 May 2015 April 2015 March 2015 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 April 2012 March 2012 October 2011 September 2011 May 2011 July 2009 June 2009 May 2009 April 2009 February 2009 November 2008 October 2008 September 2008 August 2008 July 2008 May 2008 March 2008 November 2007 October 2007 Categories Books Field Notes Life is Fun Portfolio Technology Uncategorized Blog at WordPress.com. %d bloggers