【问题标题】:mongorestore 0 document(s) restored successfully. 0 document(s) failed to restoremongorestore 0 个文档已成功恢复。 0 个文档无法恢复
【发布时间】:2021-08-11 20:06:35
【问题描述】:

我正在尝试将 mongo 从本地迁移到地图集。我做了 mongodump,它正确地创建了 .z 存档。

但是,当我尝试如下恢复时:

mongorestore --uri="mongodb+srv://<user>:<password>@xxxxx.ipmg6.mongodb.net/myDbName" --archive=mongodump_2021-05-22_09-05-44.gz --gzip

我看到了输出

2021-05-23T07:25:01.340+0200    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2021-05-23T07:25:01.350+0200    preparing collections to restore from
2021-05-23T07:25:01.360+0200    0 document(s) restored successfully. 0 document(s) failed to restore.

没有错误,但也没有处理任何文件。知道有什么问题吗?我的东西没有来自 mongo 的错误或警告?

【问题讨论】:

  • 你的文件有多大?
  • .gz 文件大小为 29KB。

标签: mongodb mongorestore


【解决方案1】:

好的解决方案是缺少--nsInclude。如果要恢复整个数据库,则应使用--nsInclude="*"

【讨论】:

    【解决方案2】:

    这对我有用:

    mongorestore --drop /dump --nsInclude="*"
    

    “/dump”位是 mongodump 目录的路径。

    【讨论】:

      猜你喜欢
      • 2021-07-13
      • 1970-01-01
      • 1970-01-01
      • 2019-05-01
      • 1970-01-01
      • 2013-09-17
      • 1970-01-01
      • 2021-01-31
      • 2012-07-01
      相关资源
      最近更新 更多