mongodb数据库插入错误

{ [MongoError: E11000 duplicate key error collection: zhihu.people index: id dup key: { : ObjectId(‘59a3b9275f063c20cc8bdec7’) }]
name: ‘MongoError’,
message: ‘E11000 duplicate key error collection: zhihu.people index: id dup key: { : ObjectId(‘59a3b9275f063c20cc8bdec7’) }’,
driver: true,
index: 0,
code: 11000,
errmsg: ‘E11000 duplicate key error collection: zhihu.people index: id dup key: { : ObjectId(‘59a3b9275f063c20cc8bdec7’) }’ }

解决方法:在插入数据库的字段中加入带id的字段,例如product_id

posted @ 2021-06-08 10:43  布都御魂  阅读(350)  评论(0编辑  收藏  举报