gpt4 book ai didi

mongodb - 具有不同文件夹名称的 mongodump

转载 作者:行者123 更新时间:2023-12-04 01:38:09 26 4
gpt4 key购买 nike

有没有办法将 mongo 数据库转储到特定的文件夹名称?假设我有一个名为 myDb

的数据库

当我使用时:

mongodump --db myDb

它生成一个转储文件夹,里面有一个 myDb 文件夹

是否可以从 mongodump 中获取类似 dump/mySpecifiedFolder 的内容?

最佳答案

您无法更改 myDB 文件夹的名称,因为它是为其包含的数据库命名的,但您可以更改 myDb 文件夹的位置。为此,请使用 --out/-o 参数。

来自 the docs :

--out , -o

Specifies the directory where mongodump will write BSON files for the dumped databases. By default, mongodump saves output files in a directory named dump in the current working directory.

所以,这个命令...

mongodump --db myDb -o /some/path/

... 会导致 mongodump 创建 /some/path/myDb

关于mongodb - 具有不同文件夹名称的 mongodump,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48620802/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com