Updating Records In Mongodb Through Pymongo Leads To Deletion Of Most Of Them
Solution 1:
What could have been other reasons for this and any ways i can find out what exactly happened ?
The first thing to check is "were there any exceptions"?
In coll.update()
, you are not setting the safe
variable. If there is an exception on the update
, it will not be thrown.
In your code you not do not catch exceptions (which is suggested) and your update does not check for exceptions, so you have no way of knowing what's going on.
The second thing to check is "how are you counting"?
The update
command can "blank out" data, but it cannot delete data (or change an _id
).
Do you have a copy of the original data? Can you run your code on a small number of those 10 or 100 and see what's happening?
What you describe is not normal with any of the MongoDB drivers. We definitely need more data to resolve this issue.
Post a Comment for "Updating Records In Mongodb Through Pymongo Leads To Deletion Of Most Of Them"