MongoEngine/mongoengine — pull request #583 by Gerrrr (2014-02-24 15:28:51+00:00)
Title: Bug in distinct method

If distinct is called on ListFired(ReferenceField('ModelName')), it raises
```TypeError: TopLevelDocumentMetaclass object argument after ** must be a mapping, not ModelName```

Patch fixes this bug by checking the type of the field before casting.