title: Spring MongoDB data can not fetch @DBRef objects with "find" query
body: <p>There is an object a classic POJO as below:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Document
  public class MyPojo {
    @DBRef
    @Field("otherPojo")
    private List&lt;OtherPojo&gt; otherPojos;
  }
  </code></pre>
  
  <p>And <code>OtherPojo.java</code>:</p>
  
  <pre><code>public class OtherPojo{
    @Id
    private ObjectId _id;
    private String someOtherFields;
  }
  </code></pre>
  
  <p>I can not cascade-save these, but I'm getting over it by saving DBRefs first and then saving my POJO list, but still when I try to fetch all list or querying some of them with below code:</p>
  
  <pre><code>Query query = new Query( Criteria.where( "myPojo.blabla" ).is( "blabla" ) );
  List&lt;MyPojo&gt; resultList = mongoTemplate.find( query, MyPojo.class, "myCollection" );
  </code></pre>
  
  <p>it returns me with a list of null DBrefs, it counts true. For example: there are saved 10 DBRefs it returns 10 null object in it, but its primitive types and other types that aren't a DBRref are all non-null.
  How can i handle this ?</p>
  
  <p>I save my objects as below:</p>
  
  <pre><code>for (MyPojo pojo : somePojoList) {
      for (OtherPojo otherPojo : pojo.getOtherPojos()) {
          mongoTemplate.save(otherPojo, "myCollection");
      }
  }
  
  // ...
  
  mongoTemplate.insert( myPojoList, "myCollection" );
  </code></pre>
  
  <p><strong>EDIT:</strong> OK, now I know if I do not specify a collection name when I'm saving otherPojos, I can fetch them (thanks to @jmen7070). But I have to write myCollection there because I'm dropping and re-creating them always. That's a use-case. So how can I say "find method to use same collection to fetch DBRefs"?</p>