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