Document FieldDoesNotExist and meta.strict
This commit is contained in:
parent
cd2d9517a0
commit
2bfb195ad6
@ -34,6 +34,9 @@ Documents
|
||||
.. autoclass:: mongoengine.ValidationError
|
||||
:members:
|
||||
|
||||
.. autoclass:: mongoengine.FieldDoesNotExist
|
||||
|
||||
|
||||
Context Managers
|
||||
================
|
||||
|
||||
|
@ -135,6 +135,11 @@ class Document(BaseDocument):
|
||||
doesn't contain a list) if allow_inheritance is True. This can be
|
||||
disabled by either setting cls to False on the specific index or
|
||||
by setting index_cls to False on the meta dictionary for the document.
|
||||
|
||||
By default, any extra attribute existing in stored data but not declared
|
||||
in your model will raise a :class:`~mongoengine.FieldDoesNotExist` error.
|
||||
This can be disabled by setting :attr:`strict` to ``False``
|
||||
in the :attr:`meta` dictionnary.
|
||||
"""
|
||||
|
||||
# The __metaclass__ attribute is removed by 2to3 when running with Python3
|
||||
|
@ -42,7 +42,14 @@ class NotUniqueError(OperationError):
|
||||
|
||||
|
||||
class FieldDoesNotExist(Exception):
|
||||
pass
|
||||
"""Raised when trying to set a field
|
||||
not declared in a :class:`~mongoengine.Document`
|
||||
or an :class:`~mongoengine.EmbeddedDocument`.
|
||||
|
||||
To avoid this behavior on data loading,
|
||||
you should the :attr:`strict` to ``False``
|
||||
in the :attr:`meta` dictionnary.
|
||||
"""
|
||||
|
||||
|
||||
class ValidationError(AssertionError):
|
||||
|
Loading…
x
Reference in New Issue
Block a user