829 viewsMern Amazona
0 Comments

connected to db
C:\Users\HP\Desktop\amazona\backend\node_modules\mongodb\lib\bulk\common.js:910
callback(new MongoBulkWriteError({
^

MongoBulkWriteError: E11000 duplicate key error collection: test.products
index: category_1 dup key: { category: “Shirt” }

Bassir Changed status to publish November 26, 2023

hello there,

you have a unique key for category in the product model. remove it like this:

https://github.com/basir/mern-amazona/blob/master/backend/models/productModel.js#L21

then remove the db and restart the server and try again.

kharateameya Posted new comment November 27, 2023