Closed
Description
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