mongodb - MongoDB插入文档时出错,我该如何解决?
问题描述
我一直在尝试通过命令提示符将 JSON 文件导入 mongoDB,但我得到的输出显示插入文档时出错。
C:\Users\chery\Documents\NUS Y2 Sem 1 Modules\BT2102\Tutorials>mongoimport --db school --collection students students.json
2018-11-07T15:37:30.974+0800 connected to: localhost
2018-11-07T15:37:31.210+0800 num failures: 50
2018-11-07T15:37:31.211+0800 error inserting documents: multiple errors in bulk operation:
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 2 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 3 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 4 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 5 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 1 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 0 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 6 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 7 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 10 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 8 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 12 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 13 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 11 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 14 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 15 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 16 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 17 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 18 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 9 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 19 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 20 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 23 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 24 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 22 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 26 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 25 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 27 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 29 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 28 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 21 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 30 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 31 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 33 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 35 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 34 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 36 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 37 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 38 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 32 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 40 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 39 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 41 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 43 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 44 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 46 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 47 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 42 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 45 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 48 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 49 }
2018-11-07T15:37:31.211+0800 imported 0 documents
我可以知道这里有什么问题以及如何纠正错误吗?
我真的很感激那里的任何帮助!
解决方案
推荐阅读
- python - 获取三个列表的补充
- c# - 如何在数据表 mvc c# 中显示 pageLength 过滤器和打印选项
- kubernetes - Grafana 无法显示 Kubernetes pod CPU 和内存使用情况,但可以显示 pod 网络和文件系统使用情况
- r - Boxplot.stats R 未识别异常值
- javascript - Emscripten:从 C/C++ 调用 JavaScript 时出现“未定义符号”;ERROR_ON_UNDEFINED_SYMBOLS 不起作用
- python - 如何获得机器学习模型(特别是 XG 提升)的模型摘要,如下面的截图所示?
- redisgraph - 如何在 redisgraph 中找到最顶层的层次结构,因为 NOT,IS 关键字尚不支持
- java - 如何在 JBPM 中设置 HTTP 请求标头
- node.js - 如何使用局部视图显示 ajax 错误?
- hibernate - Grails NonUniqueObjectException:具有相同标识符值的不同对象已与会话关联