Importing a Dataset -- ; semicolon issue?

my inputs:
mongo --port 27000 -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”
use admin
mongoimport --db applicationData --collection products --port 27000 --username “m103-application-user" --password “m103-application-pass" –authenticationDatabase admin --file “/dataset/products.json"

i get error:
2020-07-04T12:55:23.346+0000 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:14

and of course in the tests

Did you import the dataset into the ‘products’ collection of the ‘applicationData’ database?

what am i missing :frowning: ?

i run the import from the

nothing happens

screenshot please

Hi @Harry_Log,

If you are still facing any issue then please share a screenshot as @steevej-1495 requested. Else, let me know if the issue is resolved so that I can close this thread.

~ Shubham

Issue 1 - left double quotes

Your issue related to left quotes ==> Use double quotes " instead (Buggy on any code environment).

Issue 2 - change this – [to] - - (wrong syntax):

Related stackoverflow Q:

@Ezra_16731 Brilliant mate that worked a treat!

mongoimport --db applicationData --collection products --port 27000 -u “m103-application-user” -p “m103-application-pass” --authenticationDatabase “admin” --file “/dataset/products.json”

1 Like

I am encountering with this issue.
My command;
mongoimport --authenticationDatabase admin --db applicationData --collection products --port 27000 --username “m103-application-user” --password “m103-application-pass” --file “/dataset/products.json”


You have to do that outside the mongo shell.

1 Like

Hi @Ahmet_Burak_Kurt,

This :point_down:


I’m doing the same lab and I have the same issue.

Sorry but I don’t understand when you say “You have to do that outside the mongo shell”. Could you explain me, please? Thank you

It means you have to run the command at os prompt
“>” indicates you are at mongo prompt
exit and run the same command from os prompt sh# or Window cmd prompt depending on whatever your environment is

1 Like

Thank you! I was writting this command using admin :slight_smile:


I sort of came across the same issue as the fellows above in the thread. Here are the screen shots (am I not understanding something right?):
mongod --config mongod.conf expected error as there must be a process already running

Then this
mongo -u m103-application-user -p m103-application-pass --port 27000 --authenticationDatabase “admin”

Before reading this post I ran the below command in browser IDE and got this error

mongoimport --db applicationData --collection products --port 27000 -u “m103-application-user” -p “m103-application-pass” --authenticationDatabase “admin” --file “/dataset/products.json”

Following your suggestion in this post I ran it from windows prompt command
and got this error.

What am I misunderstanding?

Thank you for looking into it.

Jus to add to it.

I opened another terminal and ran the below command in it (instead of running in original Terminal 0 as before) and it worked.

mongoimport --db applicationData --collection products --port 27000 -u “m103-application-user” -p “m103-application-pass” --authenticationDatabase “admin” --file “/dataset/products.json”

Even though I resolved the lab but still would like to understand why I need to go to Windows cmd?

Your mongoimport failed as you were at mongo prompt
(>) indicates you are connected to mongo.That is why you are getting syntax error
It worked in a fresh terminal because you ran it correctly at os prompt
You don’t have to run in Windows cmd prompt
All work should be done in IDE terminal only
I mentioned run as per your environment.What i meant is in case you are doing the work on your localhost/pc you need to run it in cmd prompt
Since you are using IDE you should be running it at sh-4.4#(terminal prompt)

1 Like

HI @Timur_Akhmadulin,

I hope you found @Ramachandra_37567’s response helpful. Let us know if you are still facing any issues.

~ Shubham

Thank you guys for follow up. It makes sense.