Import data with mongorestore command

hi, please someone can help me i tried this cmd line to import mflix data to my atlas cluster: mongorestore --drop --gzip --uri / “mongodb+srv://” data
but nothing

What was the message or error you got?
Also, remove the ‘/’ after --uri on the command:
mongorestore --drop --gzip --uri “mongodb+srv://” data

1 Like

my message error :
error parsing command line options: error parsing uri (/): scheme must be “mongodb” or “mongodb+srv”

You have to put your Atlas Cluster URI in the place of “mongodb+srv://”

what place please ??

instead of this “mongodb+srv://”

the error persist…

I think I might have this figured out: From Atlas, click on your mflix project. Next click on “Command Line Tools” using the first dialog box with the option to copy, copy the command to your clipboard and paste it into your command line ( making sure you are in the correct dir (mflix-js)
Next modify the command: by adding two attributes to mongorestore. so it should look like this. mongoretore --drop --gzip --host . Finally, at the end of the string remove (authenticationDatabase admin) and add (data). Done. it worked for me!!
PS the final note: the total number of documents restored mflix.movies (45,993).


Thanks Rick, you are a saviour!

Your error is that the mongorestore is using ‘/’ as the the uri and ignoring the string “mongodb+srv…”

This is the command that you used:
mongorestore --drop --gzip --uri / “mongodb+srv://” data
try this command with ‘/’ removed after the ‘–uri’:
mongorestore --drop --gzip --uri “mongodb+srv://” data


Yup, this worked for me too. Thanks for sharing information. Just to be even more specific my line looked like this

mongorestore --drop --gzip --host mflix-shard-0/,, --ssl --username m001-student --password m001-mongodb-basics data

I’ve copied this from Command Line Tools as you explained where it’s located.

Best regards

I’ve tried removing the /, and now I get the following error:
PS C:\Users\Mega> mongorestore --drop --gzip --uri “mongodb+srv://” data

2019-02-19T00:10:20.154-0500 Failed: mongorestore target ‘data’ invalid: CreateFile data: The system cannot find the file specified.

Any Ideas?

Do you run command from your aplication folder?

Go to Command Line Tools, it’s located under Cluster section. Then navigate to mflix (or whatever you named it, but it suppouse to be mflix) and click on … on right side of COLLECTIONS. Copy this first line.

Insted of –authenticationDatabase admin enter data and that will be it.

I hope this helps a bit. Let us know have you solved it.


That worked, Thanks a lot!

Thank you very much. I was beginning to think to unregister for this course because the instructions were not clear at all.

Thanks, for me the problem was the “” after the --uri option… Simply removed it and it works!

Yes, that worked for me as well. The instructions in the README.rst file are clearly deprecated. I wasted well over an hour to troubleshoot this. NOTE TO TA: PLEASE KINDLY UPDATE THE README.rst FILE TO REFLECT THE NEW COMMAND SYNTAX.

For our specific cluster instance, here is the complete command syntax that worked for us:

mongorestore --drop --gzip --host mflix-shard-0/,, --ssl --username m220student --password m220password data


This worked for me. Thank you very much.

I think the instructions given in the lecture works only if you have mongo 3.6 and above. I have mongo 3.4 and this step worked for me.


This did it for me, thanks!

I’m not sure if the readme has changed, but mine shows a backslash character after “–uri”, not a forward slash.

The backslash character is the escape character in bash. The readme example spans two lines and the backslash is escaping the new line character. If you condense the command into a single line, while leaving the backslash, that would be interpreted differently.

Also, if you are using Windows, your escape character is “^”. The readme file should be updated to indicate this (or simply include it on a single line).