I have to insert 3 recordset from array 1 already exists and 2 are new
e.g:
db.products.insert(
[
{ imagename: "pen1", qty: 21 },
{ imagename: "pen", qty: 20 },
{ imagename: "eraser", qty: 25 }
]
)
Wherein "{ imagename: "pen", qty: 20 }"` already exists and has unique key on field "imagename" in mongodb
as for now none of them are getting inserted and throwing err: 'E11000 duplicate key error index: mongotest.mothership.$imagename_1 dup
any suggestion how to insert remaining two ignoring error in single go !