mongodb impossible (?) E11000 duplicate key error dup key when upserting
问题 My understanding is that update with upsert:true on a single document is an atomic operation so this should never result in a duplicate key error, especially not on the primary _id key, when the collection has no unique-ly indexed fields: Order.update({ _id: order._id }, query, { upsert: true }, cb) // with mongoose But this appears in the mongod.log: 2015-03-27T09:39:10.349-0400 I WRITE [conn258236] update xyz.orders query: { _id: "6353f880-c6a7-4260-809f-98e0af27b9a2" } update: { $set: { ..