mongodb-error validating settings: only one positional argument is allowed

Roudy Tarabay picture Roudy Tarabay · Jun 20, 2015 · Viewed 23.3k times · Source

I just moved to a new laptop which had mongo 3.0.0 I believe. On the new laptop I have mongo 3.0.4. and trying the script that was working on the old laptop is giving me errors. This line is giving me the error.

mongoimport --host localhost \
            -db roudy123_q \
            -collection LebaneseAmericanUniversity\(Lebanon\).json \
            --file LebaneseAmericanUniversity\(Lebanon\).json \
            --jsonArray

error validating settings: only one positional argument is allowed.

I googled the error and the only relevant result was the source code of mongoimport. So I guess it has something to do with the new version.

Answer

Sylvain Leroux picture Sylvain Leroux · Jun 20, 2015

Just a wild guess...

... but the various long options should be specified using --, not -:

mongoimport --host localhost \
            --db roudy123_q \
            --collection LebaneseAmericanUniversity\(Lebanon\).json \
            --file LebaneseAmericanUniversity\(Lebanon\).json \
            --jsonArray

Maybe this particular version of mongoimport is more punctilious about that, and will treat -db ... -collection ... as positional arguments rather than keyword arguments ?