【发布时间】:2019-05-03 16:53:51
【问题描述】:
尝试在猫鼬创建新记录并获得:
UnhandledPromiseRejectionWarning: MongoError: E11000 duplicate key error collection: admin.inventoryitems index: _id_ dup key: { : ObjectId('5bdf1c4a60ec674ee1a10006') }
我如何创建项目:
const createdItem = await InventoryItem.create(item);
项目不包含“_id”字段
【问题讨论】:
-
您能否分享您的 InventoryItem 模型定义以及如何填充
item?
标签: javascript node.js mongodb mongoose mongodb-query