Added delta tracking to documents.
All saves on exisiting items do set / unset operations only on changed fields. * Note lists and dicts generally do set operations for things like pop() del[key] As there is no easy map to unset and explicitly matches the new list / dict fixes #18
This commit is contained in:
@@ -5,6 +5,7 @@ Changelog
|
||||
Changes in dev
|
||||
==============
|
||||
|
||||
- Added delta tracking now only sets / unsets explicitly changed fields
|
||||
- Fixed saving so sets updated values rather than overwrites
|
||||
- Added ComplexDateTimeField - Handles datetimes correctly with microseconds
|
||||
- Added ComplexBaseField - for improved flexibility and performance
|
||||
|
||||
@@ -18,10 +18,21 @@ attribute syntax::
|
||||
|
||||
Saving and deleting documents
|
||||
=============================
|
||||
To save the document to the database, call the
|
||||
:meth:`~mongoengine.Document.save` method. If the document does not exist in
|
||||
the database, it will be created. If it does already exist, it will be
|
||||
updated.
|
||||
MongoEngine tracks changes to documents to provide efficient saving. To save
|
||||
the document to the database, call the :meth:`~mongoengine.Document.save` method.
|
||||
If the document does not exist in the database, it will be created. If it does
|
||||
already exist, then any changes will be updated atomically. For example::
|
||||
|
||||
>>> page = Page(title="Test Page")
|
||||
>>> page.save() # Performs an insert
|
||||
>>> page.title = "My Page"
|
||||
>>> page.save() # Performs an atomic set on the title field.
|
||||
|
||||
.. note::
|
||||
Changes to documents are tracked and on the whole perform `set` operations.
|
||||
|
||||
* ``list_field.pop(0)`` - *sets* the resulting list
|
||||
* ``del(list_field)`` - *unsets* whole list
|
||||
|
||||
To delete a document, call the :meth:`~mongoengine.Document.delete` method.
|
||||
Note that this will only work if the document exists in the database and has a
|
||||
|
||||
Reference in New Issue
Block a user