{"action":"opened","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/2893","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/2893/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/2893/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/2893/events","html_url":"https://github.com/Automattic/mongoose/issues/2893","id":69131991,"number":2893,"title":"MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index","user":{"login":"nottinhill","id":418352,"avatar_url":"https://avatars.githubusercontent.com/u/418352?v=3","gravatar_id":"","url":"https://api.github.com/users/nottinhill","html_url":"https://github.com/nottinhill","followers_url":"https://api.github.com/users/nottinhill/followers","following_url":"https://api.github.com/users/nottinhill/following{/other_user}","gists_url":"https://api.github.com/users/nottinhill/gists{/gist_id}","starred_url":"https://api.github.com/users/nottinhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nottinhill/subscriptions","organizations_url":"https://api.github.com/users/nottinhill/orgs","repos_url":"https://api.github.com/users/nottinhill/repos","events_url":"https://api.github.com/users/nottinhill/events{/privacy}","received_events_url":"https://api.github.com/users/nottinhill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-17T12:42:55Z","updated_at":"2015-04-17T12:42:55Z","closed_at":null,"body":"    Error:  { [MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: dbName.collectionName.$_id_  dup key: { : ObjectId('5530fb9a65c24ee340412369') }]\r\n\r\nAbove error message I receive when running this code in express.js (coffeescript):\r\n\r\n    batchSize = 0\r\n          sheet.forEach (item) ->\r\n            if batchSize < 100                                                                       \r\n              item       = parse.map(item)                                                       \r\n              abrechnung = new Abrechnung(                                               \r\n                aktuell: item\r\n                historie: [{\r\n                  changed: item\r\n                  userid: '54340279407267e53192c42a'\r\n                }])\r\n              batchSize += 1\r\n              abrechnungArray.push abrechnung.toObject()\r\n            else\r\n              Abrechnung.collection.insert abrechnungArray, (err, abrechnungArray) ->\r\n                if err\r\n                  console.log 'Error: ', err\r\n                  return\r\n                else    \r\n                  console.log '####### BULK-INSERT with BATCHSIZE=' + batchSize\r\n                  batchSize = 0\r\n                  return\r\n\r\nAny ideas what I am doing wrong? I am aleady\r\n\r\n"}}