I have implemented a relationship between two DBObjects using a DBRef, as described @ http://docs.mongodb.org/ecosystem/drivers/java-types/
For the sake of this question, we'll use the following two Java objects:
Foo { String name, ... }
Bar { Foo foo, ... }
The relationship works; I can see the DBRef BSON-object as an embedded document within any given instance of Bar while I'm at the MongoDB command-line, and when I query instances of Bar from Java, instances of Foo (and not DBRef) are presented as embedded documents.
My question is this: how can I search for instances of Bar which have 'foo' fields with a specific value for the 'name' field?