i am trying to call a custom mongoDB query using spring data, but query is not getting called.
Here is my code.
In Controller : call to service method
List<UserProfile> gatheringMembers = userService.getUsersProfile(membersEmail);
Here is service Method that is calling custom mongoDB query
public List<UserProfile> getUsersProfile(List<String> emails){
return userProfileRepository.findAllUsersByEmail(emails);
}
here is my mongoDB repository interface
public interface UserProfileRepository extends MongoRepository<UserProfile, String>, UserProfileRepositoryCustom {
public UserProfile findByEmail(String email);
}
and here is interface
public interface UserProfileRepositoryCustom {
public List<UserProfile> findAllUsersByEmail(List<String> emails);
}
and its implementation
public List<UserProfile> findAllUsersByEmail(List<String> emails) {
logger.info("getting all users profiles");
Query query = new Query(where("email").in(emails));
return mongoOperations.find(query, UserProfile.class);
}
when i run the code, i am getting empty list in controller. findByEmail is working fine. Can any one kindly help me whats wrong in this code.
Regards,