I use Mongo DBRef with Java driver, but the Mongo client returns a DBRef object instead of a Map object.
Document doc = new Document();
doc.append("projectName", "New project");
doc.append("owner", new DBRef("users", owner.get_id()));
client.getDatabase("db").getCollection("projects").insertOne(doc);
Then I read the collection
MongoCollection<Document> coll = client.getDatabase("db").getCollection("projects");
FindIterable<Document> result = coll.find(query);
BasicDBList list = new BasicDBList();
result.into(list);
return list;
Thank you for your help