有没有办法将 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/