title: Spring Data Mongodb find by starts with
body: <p>I'm using Spring data with mongodb.
  I have a collection called place :</p>
  
  <pre><code>{ 
    "_id" : NumberLong(281469), 
    "_class" : "com.domain.Place", 
    "name" : "paris"
  }
  </code></pre>
  
  <p>I want to get places starting with some String. 
  In mongo console I could get the result using :</p>
  
  <pre><code>db.place.find({name : {$regex : /^par/, $options: 'i'}})
  </code></pre>
  
  <p>Using the spring data repositories I've tried this but always give an empty result:</p>
  
  <pre><code>@Query(value="{'name' : {$regex : ?0, $options: 'i'}}")
  public Page&lt;PlaceDetails&gt; findByNameStartsWith(String name,Pageable pageable);
  </code></pre>
  
  <p>And in the call of the repository method, I make a concatenation this way :</p>
  
  <pre><code>repository.findByNameStartsWith("/^"+token+"/",new PageRequest(0,10));
  </code></pre>
  
  <p>while this repository method works :</p>
  
  <pre><code>@Query(value="{'name' : ?0}")
  public Page&lt;PlaceDetails&gt; findByName(String name,Pageable pageable);
  </code></pre>
  
  <p>The class is declared this way :</p>
  
  <pre><code>@Document(collection="place")
  public class PlaceDetails {
  //...
  }
  </code></pre>
  
  <p>Any idea why it doesn't work?</p>