Mongorestore unknown option "uri"

it looks like that mongorestore doesn’t accept the --uri option.

mongorestore --drop --gzip --uri mongodb+srv:// data/
2018-10-21T16:55:29.306+0200 error parsing command line options: unknown option “uri”
2018-10-21T16:55:29.306+0200 try ‘mongorestore --help’ for more information

Trying to connect to the host, it doesn’t exists (mongo shell works properly)
mongorestore --drop --gzip --username --password --host data/

I’m running on Debian 9 (Stretch) using official mongo repository
mongorestore --version
mongorestore version: built-without-version-string
git version: built-without-git-spec
Go version: go1.7.4
os: linux
arch: amd64
compiler: gc
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017

What can I do?

Thank you.

1 Like

You have to use a bit different setup, username and password as below

mongorestore --drop --gzip --uri mongodb+srv:// data


Thank you corrected command. I spent 2 hrs trying different options blindly, googling and trying. I hope the course document is updated to avoid this.


The problem is the option --uri that doesn’t exists in mongorestore command!
Using --username --password and --host it doesn’t find the host.

Any Idea?


Well, in Windows10 uri option does exist, but keep saying “port number is given” even when port number is not given. but the command @YUri_52502 seems to work and load the data into cluster

I was able to solve the same problem like this…

mongorestore --drop --gzip --uri “mongodb+srv://” data

Just simply enclosed your uri with double-quotes. Hope it helps.

Dear Bob,

  unfortunately the problem is not the uri but the --uri option itself, which is not included in mongorestore command on Debian.

I’d like to thank you anyway for your help.

Kind regards,


Are you using MongoDB Enterprise 4.0.4? I had trouble with the same problem. Also, did you put double quotations after the --uri ? or double quote your uri?

On debian, I had this problem with mongorestore from the package “mongo-tools”.
I fixed it using the mongorestore script from the vagrant machine (installed for the m103).
On the vagrant machine :
cp /usr/bin/mongorestore /vagrant/shared/
On my debian :
mv -i shared/mongorestore /usr/bin/mongorestore

I am trying to complete excersize in Chapter 1: Driver Setup for Importing data
as mentioned in lab I tried to execute below line in command prompt but gettig error

import data into Atlas

C:\Users\admin\Downloads\mflix-python>mongorestore --drop --gzip --uri mongodb+srv://
2019-03-16T20:01:24.557+0530 WARNING: ignoring unsupported URI parameter ‘retrywrites’
2019-03-16T20:01:43.831+0530 using default ‘dump’ directory
2019-03-16T20:01:43.831+0530 see mongorestore --help for usage information
2019-03-16T20:01:43.834+0530 Failed: mongorestore target ‘dump’ invalid: CreateFile dump: The system cannot find the file specified.

Can anyone help me in this.

Please review your lectures or search forums.You will get tips/answers
In this same thread if you scroll up you will know what you missed
I think data option missed at end
Also it depends from where you are running this command( i mean dir path)

@Ramachandra_37567, thanks for your reply . I was missing data option at end, adding that was able to import data

This helped tremendously!

For me, with my custom custom Atlas, the long uri did the trick, something like this
Oh, and that is connecting by clicking on the Connect button inside Atlas, then selecting connecting my application through python 3.4 or later and copy that uri!