Undefined data should not override instance methods (#49)

This commit is contained in:
Ross Lawley
2013-01-25 11:28:20 +00:00
parent 83da08ef7d
commit 621b2b3f72
6 changed files with 230 additions and 186 deletions

View File

@@ -40,6 +40,7 @@ Changes in 0.8.X
- Added support for compound primary keys (#149) (#121)
- Fixed overriding objects with custom manager (#58)
- Added no_dereference method for querysets (#82) (#61)
- Undefined data should not override instance methods (#49)
Changes in 0.7.9
================

View File

@@ -600,8 +600,7 @@ Working with existing data
--------------------------
As MongoEngine no longer defaults to needing :attr:`_cls` you can quickly and
easily get working with existing data. Just define the document to match
the expected schema in your database. If you have wildly varying schemas then
a :class:`~mongoengine.DynamicDocument` might be more appropriate. ::
the expected schema in your database ::
# Will work with data in an existing collection named 'cmsPage'
class Page(Document):
@@ -609,3 +608,10 @@ a :class:`~mongoengine.DynamicDocument` might be more appropriate. ::
meta = {
'collection': 'cmsPage'
}
If you have wildly varying schemas then using a
:class:`~mongoengine.DynamicDocument` might be more appropriate, instead of
defining all possible field types.
If you use :class:`~mongoengine.Document` and the database contains data that
isn't defined then that data will be stored in the `document._data` dictionary.