Skip to content

Repository - findBy<Field>IgnoreCase doesnt work [DATAMONGO-770] #1700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 2, 2013 · 10 comments
Closed
Assignees
Labels
in: core Issues in core support in: repository Repositories abstraction type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link

regis opened DATAMONGO-770 and commented

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));

 


Affects: 1.3 GA, 1.3.1

Referenced from: commits e8a303b, fe41202

@spring-projects-issues
Copy link
Author

@spring-projects-issues
Copy link
Author

regis commented

Whats happening ? Do you need unit test ?

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

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

@spring-projects-issues
Copy link
Author

regis commented

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

@spring-projects-issues
Copy link
Author

Thomas Darimont commented

Added PR: #78

@spring-projects-issues
Copy link
Author

Thomas Darimont commented

Please revise

@ps-tunnelsoft
Copy link

Oliver Drotbohm commented

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

I could not find the IgnoreCase query keyword in the documentation and I wonder what happened with this feature request in the milestone

@christophstrobl
Copy link
Member

@ps-tunnelsoft the Codd release train has reached EOL already quite some time ago. You can find supported keywords (may vary depending on the store implementation) in the appendix.

@ps-tunnelsoft
Copy link

@christophstrobl I just tested it and IgnoreCase keyword works but it isn't in the list of supported keywords

@christophstrobl
Copy link
Member

I see - it's missing in the Query Methods section of the reference documentation. Created #3916 for this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support in: repository Repositories abstraction type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants