MongoEngine/mongoengine — pull request #272 by kristinn (2013-04-04 15:27:19+00:00)
Title: Don't run unset on IntField if the value is 0 (zero).

Here is a lot more info about this specific issue (especially if you click the referenced issue). https://github.com/MongoEngine/mongoengine/issues/271

However, this change only makes sure that users are able to set IntField values to 0 without losing them (triggering unset). This only happens if the field in the model has the default value set to 0 (default=0).

Maybe this should be changed in a more generic way for other datatypes as well. However, MongoEngine does trigger unset on many field types if they get an empty value in the field's data type. Therefore, you can't do this in a more generic way without breaking things.

The tests do succeed after this patch has been applied to the current master tree of MongoEngine.