title: MongoDB how to load two attributes of reference document using morphia
body: <p>How to load two attributes of reference document/entity using morphia</p>
  
  <p>I have a Class Person and School like this
  <br >person class</p>
  
  <pre><code>@Entity
  public class Person {
    @Id private ObjectId id;
    private String name;
    @Embedded private PersonEducation schoolInfo;
  }
  @Embedded
  public class PersonEduction {
    @Reference private School school;
    private String year;
    private String degree;
  }
  </code></pre>
  
  <p><br>School Class</p>
  
  <pre><code>@Entity
  public class School {
     @Id private ObjectId id;
     private String name;
     private String address;
     private String description;
  }
  </code></pre>
  
  <p>How I can get id and and name fields of School in Person class
  example 
  When i want to person </p>
  
  <pre><code>Person person = datastore.find(Person.class).field("name").equals("xyz").get();
  person.gerSchoolInfo();
  </code></pre>
  
  <p>Response (Not want all School class fields)</p>
  
  <pre><code>{school:{_id:ObjectId("4fcef3e20364a375e7631fb0"), name:"SchoolA"}, year:"1990", degree:"MBA" }
  </code></pre>
  
  <p>and If I query school where _id=ObjectId("4fcef3e20364a375e7631fb0"), I get all School fields</p>
  
  <pre><code>{_id:ObjectId("4fcef3e20364a375e7631fb0"), name:"xyz", address="some add", description="some desc"}
  </code></pre>