Skip to content Skip to sidebar Skip to footer

Pymongo Getting E11000 Duplicate Key Error Index Pymongo Error

So a little background, I've worked with MongoDB before in node.js with mongoose.js. And now I decided to try out to work with python and pymongo. But when I try to insert a docume

Solution 1:

pymongo.errors.DuplicateKeyError: E11000 duplicate key error index: database.emails.$email_1 dup key: { : "mail@example.com" }

Judging by the error, you actually have a unique index defined for the email field.

FYI, you can get the index information using index_information() method:

self.collection.index_information()

Post a Comment for "Pymongo Getting E11000 Duplicate Key Error Index Pymongo Error"