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

一笑奈何 提交于 2019-12-05 03:15:16

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 ?

This error can also occur if white spaces are given without a "\" in the path to the file . Ex: This wont work:

But this would work :

If you get this error while inserting fields with --fields, the probable reason might be you are using spaces to do that.

Both -f and --fields should work in those cases Using Mongo Version 3.0.6

mongoimport --db logs --collection action_logs --type tsv -f updated_at ,transaction_time ,origin  --file parsed.tsv
mongoimport --db logs --collection action_logs --type tsv -f updated_at,transaction_time,origin  --file parsed.tsv

I think giving a white spaces in the file name of directory will also contribute to this error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!