diff --git a/mongoengine/base/document.py b/mongoengine/base/document.py index f5eae8ff..c5ef087c 100644 --- a/mongoengine/base/document.py +++ b/mongoengine/base/document.py @@ -182,7 +182,7 @@ class BaseDocument(object): """Dictionary-style field access, set a field's value. """ # Ensure that the field exists before settings its value - if name not in self._fields: + if not self._dynamic and name not in self._fields: raise KeyError(name) return setattr(self, name, value)