MongoDB M201 lab 1.1 install course dataset

Hi ,
mongoimport doesn’t work please help me :

Your syntax is not correct.There will not be any mongosh in mongoimport command
Please get the exact command from your Atlas command line

There are two versions of connecting string I copied the one "I have mongosh installed and deleted the word “mongosh” but still doesn’t work .
I have also installed MongoDB version 6.0 on my pc, but I don’t know how to start an instance of the MongoDB or in which directory copy it and run the mongoimport?


In the first snapshot -c is not correct.Just give collection name
I think you are trying to import to your sandbox cluster.Remove api version from your string
In the second snapshot you are trying to import to local instance
No need to give uri if it is local mongod instance
Is your local mongod up and running?
First try to connect to your instance.If you can connect then use mongoimport
If you installed mongodb as service it should be running on your Windows box
Otherwise you have to start manually
mongod --port xyz --dbpath --logpath
Give appropriate dir paths

Ok. I removed api version and -c but but I am unable to import the json files to m201 database.

Check your syntax.

You seem to have an extra space between - - and uri.

Your user name does not contain the string @m201-nhtgi.mongodb.net/m201.

You posted in M201 but you are using m001-student. While you may reusing your m001 cluster, at your own risk, it is preferable to create a separate one. But whatever you reuse an existing one or create a new one, you should create the course specific user specified in the M201 instructions.

Note that you should drop a collection rather than a file.

@farideh_gorji you are going too fast and missing important details on course pages. please take a breath between lessons :wink:

you are already given the shape of the connection strings.

$ mongoimport --drop -c people --uri mongodb+srv://theusername:thepassword@m201-nhtgi.mongodb.net/m201 people.json
$ mongoimport --drop -c restaurants --uri mongodb+srv://theusername:thepassword@m201-nhtgi.mongodb.net/m201 restaurants.json
  • first, create a folder, c:\m201 for example, then download handouts, on the right side of the page, and move them into it. unzip restaurants.zip to get the json file.
  • open terminal, and head into that folder cd c:\m201.
  • plug your username/password in the above strings, also replace m201-nhtgi.mongodb.net to your cluster’s address that starts with sandbox.ei....
  • if you haven’t add mongo tools in system path then use is as c:\m201-tools\bin\mongoimport

by the way, to import into local server, you need to first have a running local server. so check how you install a local mongodb server (again, link is given in the same page).

good luck on the course :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.