Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Web Technology by (50.2k points)

I am importing a dummy JSON file into MongoDB and I am getting the following error, a Google search yields no definitive explanation, and though this topic is already on here, that's more a syntax related error.

I think there is an issue with my path [format correct].

The error:

$ mongoimport --jsonArray --collection bank_data /Macintosh HD/Users/Tinus/Downloads/bank_data.json/bank_data.json

2016-09-20T13:23:56.592+1200    error validating settings: only one positional argument is allowed

-: Running OSX -: Mongod started -: Using /data/db path and connected to test "All good" -: running mongoimport from separate shell

$ mongo --version MongoDB shell version: 3.2.8

$ mongoimport --jsonArray --collection some_data --file /path/path/data.json

$ mongoimport --jsonArray --collection some_data /path/path/data.json

1 Answer

0 votes
by (107k points)

You just have to quote your path:

$ mongoimport --jsonArray --collection bank_data '/Macintosh HD/Users/Tinus/Downloads/bank_data.json/bank_data.json'  

The error

error validating settings: only one positional argument is allowed

I think your path is having a space that means in MongoDB, it will split it into two separate arguments (if not guarded by surrounding quotes)

Related questions

0 votes
0 answers
0 votes
2 answers
asked Sep 9, 2019 in SQL by Sammy (47.6k points)
0 votes
1 answer
asked Sep 6, 2019 in SQL by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...