I have been querying mongodb using mongorepository and spring data.
My function looks like this:
@Repository
public interface UserRepository extends MongoRepository<User,String> {
@Query(value="{'email' : ?0}")
User findByEmail(String email);
}
My collection in mongodb looks like this
> db.user.find();
{ "_id" : "1", "email" : "[email protected]", "password" : "$2a$12$lDJgMZNLAcxv2J.QTZSjAuWJdPleBxXq.M4aj9itrR1RMDkgmwN7m", "name" : "def", "active" : 1, "isLoacked" : false, "isExpired" : false, "isEnabled" : true, "_class" : "com.x.gateway.auth.User" }
It always returns null value.