Nested query in mongodb using spring data
<p>I am trying to use nested <code>Mongodb</code> query but it does not work.
It is similar to <a href="https://stackoverflow.com/questions/26887505/spring-data-mongodb-query-for-subdocument-field">Spring data mongodb query for subdocument field</a></p>

<p>But suggestions mentioned there does not work.</p>

<p>Please find my documents below.</p>

<pre><code>@Document
public class Ticket {

  @Id
  private String id;

  @DBRef
  @CascadeSave
  private Customer customer;

  // getters and setters   
}

@Document
public class Customer {

  @Id
  private String id;

  private String firstName;

  // getters and setters
}

public interface TicketRepository extends MongoRepository&lt;Ticket, String&gt; {

  public List&lt;Ticket&gt; findByCustomerFirstName(String firstName);

  }
</code></pre>

<p>I tried both <code>findByCustomerFirstName</code> and <code>findByCustomer_FirstName</code> but it does not work. Any suggestions ?</p>