如何恢复单个文件的 mongodump

问题描述 投票:0回答:1

几个月前,我对 mongodump 数据库进行了转储,结果生成了一个文件,而不是多个 bson 和 json 文件:

![enter image description here

我尝试使用以下方法恢复它:

mongorestore --drop --db lodeep 转储

dump 是包含该文件的文件夹,但我得到这个:

enter image description here

我不记得我到底是如何制作这个转储的。以及为什么它不像通常的垃圾场。以及为什么该文件没有扩展名。我有点失落。我真的需要这些数据。

当我这样做时:

头 mongodump-prod-db

我看到这确实是我的数据库及其集合:
enter image description here

请问有什么帮助吗?

mongodb mongodb-atlas mongodump mongorestore mongodb-tools
1个回答
0
投票

您可以使用命令恢复单个文件转储

mongorestore --drop < dump.gz

数据库名称将从文件中获取。如果您在执行转储时使用了

--archive
标志,则必须将该选项添加到恢复命令中。

© www.soinside.com 2019 - 2024. All rights reserved.