When I try to enter a new document in mongo with a value in a field that already exists in another document, I get this when I repeat the error object:
for(var att in err){ console.log(att+": "+err[att]); }
name: MongoError err: E11000 duplicate key error index: draw.users. $ email_1 dup key: {: " spam@online.no "} code: 11000 n: 0 ok: 1
So this tells me that I want to know the problem in the email field. But can I get the offending field as a key / value, and not just a string?
source share