tags:

views:

26

answers:

2

Hi,

I'm new to MongoDB and I have hard time to backup my local DB and restore it on my server. I found the link on Mongo's website : http://www.mongodb.org/display/DOCS/Import+Export+Tools but I still have problems with the restore.

When I do my backup I call

mongodump --db Gen

Then I see that all the collections are dump in /bin/dump/Gen folder

I copy-paste from local to the server in the same folder the call

mongorestore --db Gen --drop --dbpath dump/Gen

But I get the following : Error : root directory must be a dump of a single database when specifying a db name with --db

What am I doing wrong?

Thanks for the help!

A: 

I think your folder structure may be getting messed up when you try to move it. For instance, this works for me:

$ ./mongodump --db Gen
$ ./mongorestore --db Gen --drop dump/Gen/

Can you try not moving the dump directory, and restoring from /bin/dump/Gen?

The directory you specify should have .bson files in it, e.g.,

$ ls /bin/dump/Gen
foo.bson  bar.bson  baz.bson
kristina
Hi Kristina, if I do it on my local computer it works fine, the db is restored and I don't get any error. The directory that I move has the .bson files in it. I can't do the restore since my dbs are only visible on local, can't find out how to "open" my server (win2008) so I can see it from the outside, I think I will start an other question for this one.
VinnyG
Okay. The if statement before this error is literally "if (is_directory(p))" where p is a file/directory in dump/Gen. Are you sure there are no subdirectories in there?
kristina
A: 

Ok I find out what I'm doing wrong :

I was doing

mongorestore --db Gen --drop --dbpath dump/Gen

But without the --dbpath it works just fine!

mongorestore --db Gen --drop dump/Gen

Thanks everyone!

VinnyG