From dd006a502eede24bad93361c74d6239fc3be4998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristinn=20O=CC=88rn=20Sigur=C3=B0sson?= Date: Thu, 4 Apr 2013 17:09:05 +0200 Subject: [PATCH] Don't run unset on IntField if the value is 0 (zero). --- mongoengine/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoengine/base.py b/mongoengine/base.py index f73af4cc..c2d74f3d 100644 --- a/mongoengine/base.py +++ b/mongoengine/base.py @@ -1207,7 +1207,7 @@ class BaseDocument(object): # Determine if any changed items were actually unset. for path, value in set_data.items(): - if value or isinstance(value, bool): + if value or isinstance(value, bool) or isinstance(value, int): continue # If we've set a value that ain't the default value dont unset it.