Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-770

Repository - findBy<Field>IgnoreCase doesnt work

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: 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("[email protected]");
      

       

      its NOT working - i dont find a user document with

      UserDocument foundUser = repository.findByEmailIgnoreCase("[email protected]");
      

       

      I also try with the firstname it also doesnt work

      Here my logs

       
      DEBUG o.s.d.m.c.MongoTemplate - findOne using query: { "email" : "[email protected]"} 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));
      

       

        Attachments

          Activity

            People

            • Assignee:
              thomasd Thomas Darimont
              Reporter:
              regis.leray regis
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: