From the documentation:
"Java supports DB references using the DBRef class."
http://www.mongodb.org/display/DOCS/Database+References
You can make a DataBase reference in java like so:
import com.mongodb.Mongo;
import com.mongodb.DB;
import com.mongodb.DBRef;
import org.bson.types.ObjectId;
import com.mongodb.DBObject;
Mongo connection = new Mongo("localhost", 27017);
DB db = connection.getDB("test");
DBRef myDbRef = new DBRef(db, "place", new
ObjectId("4b0552e4f0da7d1eb6f126a2"));
DBObject doc = myDbRef.fetch();
System.out.println(doc);
The above prints the referenced document:
{ "_id" : { "$oid" : "4b0552e4f0da7d1eb6f126a2"} , "users" : 10.0 ,
"male" : 5.0 , "female" : 5.0 , "mchid" : { "$oid" :
"4b0552e4f0da7d1eb6f126a3"} , "pos" : [ 50.0 , 40.0] , "time" :
1.312121212E9}
For further reading, here is a link to the documentation on the DBRef
class:
http://api.mongodb.org/java/current/com/mongodb/DBRef.html
Hopefully the above will help you accomplish what you need to do.
Good Luck!