hmarr/mongoengine — Issue #325: get_or_create fails
Author: wpjunior
Created: 2011-10-19 11:09:22+00:00
State: open

for this test case

```python
from mongoengine import *
connect('test')

class Unid(Document):
name = StringField()

class Person(Document):
name = StringField()
unid = ReferenceField('Unid')

Unid.drop_collection()
Person.drop_collection()

u = Unid(name="Lethus TI")
u.save()

p1 = Person(name="Wilson", unid=u)
p1.save()

p2 = Person(name="Joinha")
p2.save()

p, created = Person.objects.get_or_create(unid=None)

assert created=False
assert p==p2