【问题标题】:Mongo update to 3.2 gives error 'GridFS: Index with name: files_id_1_n_1 already exists with different options'Mongo 更新到 3.2 给出错误 'GridFS: Index with name: files_id_1_n_1 already exists with different options'
【发布时间】:2016-10-25 15:01:19
【问题描述】:

在将 mongo 从 3.0 更新到 3.2 后,尝试使用 mongofiles 将新文件放入我的 gridFS 时出现以下错误:

2016-10-25T15:23:10.765+0200 失败:将“execute.sh”存储到 GridFS 时出错:名称为 files_id_1_n_1 的索引已存在不同选项

因此,文件被部分插入到 GridFS 中。我可以看到集合 .chunks 和 .files 中的条目,但我无法使用 mongofiles 或 Java 驱动程序获取存储的文件。

【问题讨论】:

    标签: mongodb


    【解决方案1】:

    解决方案是删除 .file 集合索引 files_id_1_n_1。 我是用 robomongo 做的,但你也可以直接用 mongo 控制台来做

    db.getCollection('configs.chunks').dropIndex('files_id_1_n_1')

    然后我只是用 mongofiles 放置了一个新文件,它重新创建了索引。 我已通过安全性重新索引,但也许没有必要。

    db.getCollection('configs.chunks').reIndex()

    我没有发现这两个索引之间有任何区别,也许我的解决方案不是最好的,但它确实有效。

    【讨论】:

      猜你喜欢
      • 2022-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-03
      • 1970-01-01
      • 1970-01-01
      • 2019-12-09
      • 1970-01-01
      相关资源
      最近更新 更多