MongoDB 一个文档中的多个 _id 字段错误

问题描述

我正在尝试恢复 MongoDB 转储,但在一个集合中失败并显示错误

[ec2-user@staging3 mongo_dump]$ mongo_tools/bin/mongoimport --host=10.20.1.205:27017 --db=development --collection=pages --verbose pages.json
2021-06-02T10:04:50.101+0000    using write concern: &{majority false 0}
2021-06-02T10:04:50.105+0000    using 2 decoding workers
2021-06-02T10:04:50.105+0000    using 1 insert workers
2021-06-02T10:04:50.105+0000    will listen for SIGTERM,SIGINT,and SIGKILL
2021-06-02T10:04:50.109+0000    filesize: 466145987 bytes
2021-06-02T10:04:50.109+0000    using fields:
2021-06-02T10:04:50.109+0000    connected to: mongodb://10.20.1.205:27017/
2021-06-02T10:04:50.109+0000    ns: development.pages
2021-06-02T10:04:50.109+0000    connected to node type: standalone
2021-06-02T10:04:50.257+0000    Failed: bulk write error: [{[{can't have multiple _id fields in one document}]},{<nil>}]
2021-06-02T10:04:50.257+0000    999 document(s) imported successfully. 1 document(s) Failed to import.

我也用 BSON 尝试过 mongorestore,但我遇到了同样的错误

我不确定一个文档怎么会有多个 _id 字段。 有没有办法解决这个问题或在导出的 JSON 中找到这个特定的文档? 谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)