M312 Chapter 3 - mongorestore command

When I run the mongorestore command (line 11 of response_time_degredation.sh) I’m getting an error:

vagrant@m312:~$ mongorestore --drop --gzip --port 27001 -d londonbikes /shared/dump

2020-01-21T15:03:57.308+0000 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead

2020-01-21T15:03:57.310+0000 Failed: mongorestore target ‘/shared/dump’ invalid: stat /shared/dump: no such file or directory

Any suggestions to get this command to function?

First, look at the mongorestore documentation at https://docs.mongodb.com/manual/reference/program/mongorestore/ in order to use the appropriate options.

Second, the error target ‘/shared/dump’ invalid: stat /shared/dump: no such file or directory indicates that you are not specifying the appropriate location for the dump.

This is how I have solved it:

First, you have to unpack the downloaded file:
$ cd /shared

$ tar zxvf londonbikes.tgz

That creates the structure /shared/dump/londondonbikes/…

Secondly, mongorestore syntax must be modified. If it is executed as indicated, it will give us enough information about what needs to be modified.

1 Like