Mongorestore not recognized

I’m running windows 7, MongoDB shell version4.0,5
I have successfully logged into the Atlas shell using a connection string.
If I change to the mflix folder containing the downloads and run the following:

mongorestore --drop --gzip --uri \ “mongodb+srv://” data
I get command not recognized.

The way my installation works is that mongo has to be started from the installation directory and the target db is supplied as a --dbpath parameter. I cannot start mongo from just anywhere so logging into the mflix directory and then running mongorestore from that location does not work.
There is apparently no path variable that would allow me to run this command the way it is presented.
Please advise.

1 Like

You always have the choice to enter the absolute path of mongorestore to run anywhere.

On my system ‘C:\Program Files\MongoDB\Server\3.4\bin\mongorestore.exe’ works fine. But I seldom use that as I do Linux. Alternatively you may change directory into C:…\3.4\ above and run it as .\mongorestore but now you have to specify the absolute path name of the data directory.

Ok. I log into th mlab-js directory which is, in my case:


Then I run:

‘c:\Program Files\MongoDB\Server\4.0\bin\mongorestore’ --drop --gzip --uri \ “mongodb+srv://” data
and I get:

The filename, directory name or volume label syntax is incorrect

Alternatively, I have logged into the MongoDB installation directory, which in my case is:

‘c:\Program Files\MongoDB\Server\4.0\bin’

Then I run:

mongorestore --drop --gzip --uri \ “mongodb+srv://” C:\Users\Bob\SWDev\Training\MongoDB-M220\mflix-js\data

And I get the following error:

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

I’ve played around a bit with the strings and quotes but can’t crack it.

Why a backslash between --uri and “mongodb+srv…” ?

Remove the backslash after --uri --> \ <-- and try again.

Thank you. I removed the backslash and the program was recognized. Unfortunately, it does not appear to have imported anything.(see attachment).

Getting very discouraged.

Why do you pass C: as the last argument?

It must be a directory path that contains the data files.

Hey, add the path to the data in the laboratory. you have to add a path to the dowload data, as the example. “C:\Users\Bob\SWDev\Training\MongoDB-M220\mflix-js\data”

I had the full path but notepad put a crlf after the c: so it looked wrong.
I fixed that and then realized that the connect string needed a /test after the
The database appears to be loading now.
Thanks all.

1 Like