I have mongo DB installed in the following path c:\mongodb\bin
. I have configured my environment variable PATH in advanced settings.I also have mongod running .When I run the following command mongorestore dump from the following path c:\hw1-1\dump
(This contains the BSON files) I'm getting this error:
Don't know what to do with the dump file
I have referred to this thread to check my path.
in mongodb 3.0 or above, we should specify the database name to restore
I got this error when I had a collection matching the name of the one I was trying to restore present in Mongo ended up going into Mongo and deleting it using db.m101.drop();
If you're using
mongoexport
to create the dump, be sure to usemongoimport
rather thanmongorestore
to load it.You probably saw this error:
Which means in this case, that there is no file or directory called
dump
in your current working directory. So, Try this firstcd c:/hw1-1/
(or whatever the correct syntax is on Windows, I can't test it.) Alternatively you can specify the full path to thedump
directory:I'm on
version 3.2 windows
and mymongorestore
seems to have a bug:If I specify
/db:database_name
or/d database_name
I get the error:Instead if I let it run on the whole dump directory it seems to work. The command I used is:
mongorestore /host:remote_host dump
My current directory structure is:
This error message "don't know what to do with file" can also occur if you have a BSON file that does not have a .bson file extension.
Generally this isn't a problem since
mongodump
generates the files with .bson extensions, but in my case I had a BSON file that was not generated bymongodump
and had a different file extension.