From eb1b6e34c71abe45d96cbf356f1253a3ca5c51a6 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Fri, 25 Jan 2013 11:51:58 +0000 Subject: [PATCH] Updated upgrade docs (#49) --- docs/upgrade.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/upgrade.rst b/docs/upgrade.rst index 9c6c9a9d..d3282487 100644 --- a/docs/upgrade.rst +++ b/docs/upgrade.rst @@ -56,6 +56,26 @@ you will need to declare :attr:`allow_inheritance` in the meta data like so: :: meta = {'allow_inheritance': True} +Previously, if you had data the database that wasn't defined in the Document +definition, it would set it as an attribute on the document. This is no longer +the case and the data is set only in the ``document._data`` dictionary: :: + + >>> from mongoengine import * + >>> class Animal(Document): + ... name = StringField() + ... + >>> cat = Animal(name="kit", size="small") + + # 0.7 + >>> cat.size + u'small' + + # 0.8 + >>> cat.size + Traceback (most recent call last): + File "", line 1, in + AttributeError: 'Animal' object has no attribute 'size' + Querysets ~~~~~~~~~