Mongodb monogorestore“根目录必须是单个数据库的转储" [英] Mongodb monogorestore "root directory must be a dump of a single database"

查看:88
本文介绍了Mongodb monogorestore“根目录必须是单个数据库的转储"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将mongodump还原到一个不同名称的数据库(应该可以通过--db <dbname>开关来实现).

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

我的工作目录包含一个转储文件夹,其中包含一个数据库转储.

但是,当我尝试此命令时:

However, when I try this command:

mongorestore --port xxxxx --db some_destination_db

我收到以下错误:

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

我不知道为什么要这么做,并且在Google上找不到任何帮助.有人有什么想法吗?

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

推荐答案

您需要包括要从其还原的源数据库转储目录的路径(从MongoDB 2.6起).

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

例如,如果从"twitter"还原到"some_destination_db",您的命令行将类似于:

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

mongorestore --port xxxxx --db some_destination_db转储/转发器

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

这篇关于Mongodb monogorestore“根目录必须是单个数据库的转储"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆