Mongodb monogorestore "root directory must be a dump of a single database"
Asked Answered
C

2

3

I'm trying to restore a mongodump to a differently named database (which should be possible via --db <dbname> switch).

My working directory contains a single dump folder, which contains a single db dump.

However, when I try this command:

mongorestore --port xxxxx --db some_destination_db

I get the following error:

 ERROR: ERROR: root directory must be a dump of a single database
 ERROR:        when specifying a db name with --db

I have no idea why I'm getting this, and can't find any help on google. Anyone have any ideas?

Cosimo answered 13/1, 2015 at 9:52 Comment(2)
I think in the directory where you are applying the mongorestore command has dumps more than one database. Try performing the dump command again to a new empty directory, and then import.Boracic
@LeonardoDelfino - definately only one db in the dump directory. I created the dump with mongodump --db xxx which specifies a single db to process. Have also verified manually - only one subfolder in the dump directory (named same as db).Cosimo
B
13

You need to include the path of the source db dump directory to restore from (as at MongoDB 2.6).

For example, if restoring from "twitter" to "some_destination_db" your command line would be similar to:

mongorestore --port xxxxx --db some_destination_db dump/twitter

Bellda answered 13/1, 2015 at 13:48 Comment(0)
G
0

May be your destination path contains some subfolders

Golgotha answered 6/11, 2017 at 6:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.