Spring Data MongoDB
  1. Spring Data MongoDB
  2. DATAMONGO-770

Repository - findBy<Field>IgnoreCase doesnt work

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3 GA, 1.3.1
    • Fix Version/s: 1.4 M1 (Codd)
    • Component/s: Core, Repository
    • Labels:
      None
    • Sprint:
      SpringOne Aftermath

      Description

      I create a simple user document with an email field,

       
      @Document(collection = "user")
      public class UserDocument {
      
          @Id
          private ObjectId id;
      
          private String status;
          private String firstname;
          private String lastname;
      
          @Indexed(unique = true)
          private String email;
      
         all getter/ setter provided
      
      }
      

       

      Here my repository

       
      public interface UserRepository extends CrudRepository<UserDocument, ObjectId>, QueryDslPredicateExecutor<UserDocument> {
          UserDocument findByEmailIgnoreCase(String email);
      
      }
      

       

      its working - i find a user document with

       
      UserDocument foundUser = repository.findByEmailIgnoreCase("test@test.com");
      

       

      its NOT working - i dont find a user document with

      UserDocument foundUser = repository.findByEmailIgnoreCase("Test@Test.com");
      

       

      I also try with the firstname it also doesnt work

      Here my logs

       
      DEBUG o.s.d.m.c.MongoTemplate - findOne using query: { "email" : "Test@Test.Com"} in db.collection: portfolio_test.user
      

       

      I m using spring-data-mongodb 1.3.1
      mongodb 2.4.6
      open jdk 7

      I try to debug but it is in spring-data-common where it is handle the findBy stragegy lookup

      PS: right now im using Query DSL to handle this

       
      QUserDocument userDocument = new QUserDocument("userdocument");
      return userRepository.findOne(userDocument.email.equalsIgnoreCase(email));
      

       

        Activity

        Show
        regis added a comment - The bug seems to be there since 1.2.x http://forum.spring.io/forum/spring-projects/data/nosql/124545-how-describe-mongodb-regex-ignorecase-query-using-interface-method-name
        Hide
        regis added a comment -

        Whats happening ? Do you need unit test ?

        Show
        regis added a comment - Whats happening ? Do you need unit test ?
        Hide
        Oliver Gierke added a comment -

        IgnoreCase is currently not supported at all. We're going to include that in the first milestone of the upcoming release train Codd.

        Show
        Oliver Gierke added a comment - IgnoreCase is currently not supported at all. We're going to include that in the first milestone of the upcoming release train Codd.
        Hide
        regis added a comment -

        It should be great to specify in documentation what is supported like in jpa data
        http://docs.spring.io/spring-data/jpa/docs/1.4.1.RELEASE/reference/htmlsingle/#d0e2609

        Show
        regis added a comment - It should be great to specify in documentation what is supported like in jpa data http://docs.spring.io/spring-data/jpa/docs/1.4.1.RELEASE/reference/htmlsingle/#d0e2609
        Show
        Thomas Darimont added a comment - Added PR: https://github.com/spring-projects/spring-data-mongodb/pull/78
        Hide
        Thomas Darimont added a comment -

        Please revise.

        Show
        Thomas Darimont added a comment - Please revise.

          People

          • Assignee:
            Thomas Darimont
            Reporter:
            regis
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Agile