title: Java Spring Mongo Sort Ignore Case issue
body: <p>I am using Spring-Data-mongodb performing all kind of requests to MongoDB.</p>
  
  <p>When trying to perform paging &amp; sort with ignore case I get an exception,</p>
  
  <p>Here's my code: </p>
  
  <pre><code>Sort.Order order = new Sort.Order(ascending? Sort.Direction.ASC: Sort.Direction.DESC, sortKey).ignoreCase();
      Query query = new Query(filter).with(new PageRequest(page, size, new Sort(order)));
      return mongoTemplate.find(query, clazz,collection);
  </code></pre>
  
  <p>notice the .IgnoreCase() method applied on the Sort.Order Object.</p>
  
  <p>The Query .with Method fails and throws the exception: </p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Given sort contained an Order for lastName with ignore case! MongoDB does not support sorting ignoreing case currently!
        at org.springframework.data.mongodb.core.query.Query.with(Query.java:179)
        at org.springframework.data.mongodb.core.query.Query.with(Query.java:162)</p>
  </blockquote>
  
  <p>If removing the .IgnoreCase() method, i.e executing the following code:</p>
  
  <pre><code>Sort.Order order = new Sort.Order(ascending? Sort.Direction.ASC: Sort.Direction.DESC, sortKey);
  Query query = new Query(filter).with(new PageRequest(page, size, new Sort(order)));
  return mongoTemplate.find(query, clazz,collection);
  </code></pre>
  
  <p>Everything works fine, except of course I don't get insensitive sorted results.</p>
  
  <p>hence I might get A B C a1 a2, instead of A a1 a2 B C.</p>
  
  <p>Even though the exception mentions that mongoDB doesn't support IgnoreCase sort, I am using mongo 3.4 which in my understanding does support ignoreCase option for pageable sort (<a href="https://jira.mongodb.org/browse/SERVER-90" rel="nofollow noreferrer">Here's the official JIRA issue regarding insensitive search feature added</a>), and my spring-data-mongodb package is 1.8.</p>