gpt4 book ai didi

MongoDb:如何从 .gz 文件导入转储数据?

转载 作者:IT老高 更新时间:2023-10-28 13:26:25 25 4
gpt4 key购买 nike

我想从我的 .gz 文件中导入转储数据。

文件的位置是home/Alex/Documents/Abc/dump.gz,db的名称是"Alex"

我试过 mongorestore --gzip --db "Alex"/home/Alex/Documents/Abc/dump.gz

但它显示错误:

 2018-10-31T12:54:58.359+0530   the --db and --collection args should 
only be used when restoring from a BSON file. Other uses are
deprecated and will not exist in the future; use --nsInclude instead
2018-10-31T12:54:58.359+0530 Failed: file
/home/Alex/Documents/Abc/dump.gz does not have .bson extension.

如何导入?

最佳答案

转储命令:

mongodump --host localhost:27017 --gzip --db Alex --out ./testSO

恢复命令:

mongorestore --host localhost:27017 --gzip --db Alex ./testSO/Alex

完美运行!


使用存档时:

转储命令:

mongodump --host localhost:27017 --archive=dump.gz --gzip --db Alex

恢复命令:

mongorestore --host localhost:27017 --gzip --archive=dump.gz --db Alex

Note:- While using archive you need to stick with the database name.

不支持不同的数据库名称或集合名称。对于 more info .

关于MongoDb:如何从 .gz 文件导入转储数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53078520/

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