title: How to fix 'Projection operator not supported' error on CosmosDB for MongoDB api?
body: <p>I try to deploy a java spring application on azure.
  This application uses a local MongoDB 4.0. I try to replace it with Azure CosmosDB. Connection is OK but running my application tests gives following error: </p>
  
  <blockquote>
    <p>"<a href="http://org.springframework.data" rel="nofollow noreferrer">http://org.springframework.data</a> .mongodb.UncategorizedMongoDbException: Query failed with error code 2 and error message 'Projection operator not supported.' on server …<a href="http://...azure.com:10255" rel="nofollow noreferrer">http://...azure.com:10255</a> ; nested exception is com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'Projection operator not supported.'"
    Projection operator seems to be generated by MongoRepository class.</p>
  </blockquote>
  
  <pre class="lang-java prettyprint-override"><code>    import org.springframework.data .mongodb.repository.MongoRepository;
      import org.springframework.data .mongodb.repository.Query;
      import org.springframework.stereotype.Repository;
  
      @Repository
      public interface UserRepository extends MongoRepository&lt;User, UUID&gt;, UserRegexSearch{
  
          public Optional&lt;User&gt; findByEmail(String email);
      }
  </code></pre>