hmarr/mongoengine — pull request #359 by jwilder (2011-11-17 00:55:08+00:00)
Title: Fix/test for ReferenceFields being saved when they are unchanged

If you save a Document that contains a ReferenceField, the ReferenceField is saved again even if it does not have any outstanding changes.
This particular bug only happens when you assign a newly created and saved Document to the ReferenceField as opposed to assigning a Document that
was loaded from the DB.

E.g.
a = Document()
a.save()

b.a = a
b.save() # a is saved again incorrectly

vs.

a = Document.find(...)
b.a = a
b.save() # only b is saved