fix issue introduced by https://github.com/mongodb/morphia/issues/492

Support querying by DBRef
slight logic tweaks in Mapper
reformatting in the test
Merge branch 'pull-request-568'