Link to similar problem
(assuming above link provides context)
For a very limited duration, Mongodb in my case, receives a lot of connections. During this time-span if any insert
happens, multiple duplicate documents get created.
Please note that, from code, I'm saving only one document. However, mongodb stores duplicates with different _id
s.
Many solutions suggest adding unique index on collection, but it isn't possible in my case.
What could be the best way of making sure that for one insert operation, there is only one entry in the database?
Also, what is the reason it creates duplicate documents? I use mongoengine. Is it mongodb
, mongoengine
or webserver
(apache
) that is making retry insert
calls and why?
Versions used:
mongoengine 0.8.7
pymongo 2.8.1
mongodb 2.6.12
Python 2.7.12