• Register
0 votes

Problem :

I want Import the dummy JSON file into my MongoDB but facing below error.

I am unable to understand the below error and so can not find the suitable "simple English" explanation nowhere to understand it by myself, so if you have any solution please send it to me.

The error in detail as below:

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

2019-12-18T13:23:56.592+1200    error validating settings: only one positional argument is allowed

Tried running the OSX -: Mongod started -: Using the /data/db path and connected to my test "All good" -: but running mongoimport from the separate shell gave below

$ 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

6 5 3
7,540 points

1 Answer

0 votes

Solution :

Try it as mentioned below by quoting your path

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

The error as given below

error validating settings: only one positional argument is allowed

usually comes from the fact that your path contains the space which results in the splitting of it into two separate arguments if you are not guarded it by surrounding quotes.

Also your path is ending with '...bank_data.json/bank_data.json' and not just one 'bank_data.json' this is also wrong.

9 7 4
38,600 points

Related questions

1 vote
1 answer 117 views
Problem : I am very new to Node.js. I want to create a small application which uses the express and mongosse to store some of the users in my based cloud database i.e. mongoDB via mlab. Please find below MyUser.js (models/MyUser.js) var dbmongoose = require('mongoose'); ... hard from past few days to fix above error but I am still unable to fix it. I am looking for expert help to fix above error.
asked Apr 8 morrisBson 3.2k points
0 votes
1 answer 573 views
Problem : I had created /data/db in my root directory and ran ./mongod but getting below error : [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating [initandlisten] shutdown: going to ... .. [initandlisten] now exiting [initandlisten] shutting down with code:100 Have anybody faced above error? any clues to fix above error?
asked Jan 4 alecxe 7.5k points
0 votes
1 answer 33 views
Problem: I have fundamental knowledge of node.js, mongodb and expressjs. Currently I am trying to use the expressjs only for a backend. I also want to store data into a mongodb using the express. All of my view part is completely done in zend. I do not need the view to be in ... is how I have tried to redirect it to index.js app.get("/index",function(req,res){ console.log("route to index"); });
asked Aug 13 Raphael Pacheco 4.9k points
0 votes
2 answers 27 views
Problem: I want to execute the subsequent command by using command line: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Send-MailMessage -from "mail.me" -to "mail.me" -Subject "PS test !" -Body "Hi this is a power shell mail test" -SmtpServer ... SendMailMessage My main problem is that the same above command works really well when I directly execute it in PowerShell, but without a path.
asked Aug 22 Raphael Pacheco 4.9k points