mongodb 是否可以为 mongodump 指定目录/文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10128719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 12:36:31  来源:igfitidea点击:

Is it possible to specify a directory/folder for mongodump?

mongodbmongodump

提问by ericsoco

I'd like to specify the directory to which mongodumpdumps, via a switch on the mongodump command. Is this possible?

我想通过 mongodump 命令上的开关指定mongodump转储的目录。这可能吗?

回答by Justin Jenkins

You don't need a script. From the docs:

你不需要脚本。从文档

--out <path>, -o <path>

Specifies the directory where mongodump will write BSON files for the dumped databases.

--out <path>, -o <path>

指定 mongodump 将为转储的数据库写入 BSON 文件的目录。

Example:

例子:

mongodump -o /mydir/

Lots of other options there, check it out.

那里有很多其他选择,请查看。

回答by JavaadPatel

You can view all the commands for mongodump by typing "mongodump --help" in the command prompt (NB. You have to be in the folder that contains mongodump.exe).

您可以通过在命令提示符下键入“mongodump --help”来查看 mongodump 的所有命令(注意,您必须位于包含 mongodump.exe 的文件夹中)。

You can use a command like:

您可以使用如下命令:

mongodump /host <hostIP> /port <port> /d <database> /c <collection> /o <outputDirectoryPath>