这是什么错误
(node:23028) UnhandledPromiseRejectionWarning: MongoError: E11000 duplicate key error collection: comment2.users index: Username_1 dup key: { Username: null }
at Function.create (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\core\error.js:51:12)
at toError (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\utils.js:123:22)
at C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\operations\common_functions.js:265:39
at handler (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\core\sdam\topology.js:913:24)
at C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\cmap\connection_pool.js:356:13
at handleOperationResult (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\core\sdam\server.js:492:5)
at MessageStream.messageHandler (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\cmap\connection.js:272:5)
at MessageStream.emit (events.js:315:20)
at processIncomingData (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\cmap\message_stream.js:144:12)
at MessageStream._write (C:\Users\Administrator\Desktop\作业\mongo测试\test4\node_modules\_mongodb@3.5.10@mongodb\lib\cmap\message_stream.js:42:5)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at MessageStream.Writable.write (_stream_writable.js:318:11)
at Socket.ondata (_stream_readable.js:717:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
(node:23028) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:23028) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
正在回答 回答被采纳积分+1
- 参与学习 人
- 解答问题 307 个
前端工程师会后端开发已是趋势。从node.js到koa2再到数据库知识。结合真实项目,从项目需求分析、接口和数据设计到业务开发,帮你打通前后端任督二脉,为就业加码。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星