0
我想使用弹簧数据调用自定义mongoDB查询,但查询没有被调用。调用弹簧数据的自定义mongoDB查询失败
这是我的代码。
在控制器:调用服务方法
List<UserProfile> gatheringMembers = userService.getUsersProfile(membersEmail);
这里是正在调用自定义的MongoDB的查询
public List<UserProfile> getUsersProfile(List<String> emails){
return userProfileRepository.findAllUsersByEmail(emails);
}
这里的服务方式是我的MongoDB库接口
public interface UserProfileRepository extends MongoRepository<UserProfile, String>, UserProfileRepositoryCustom {
public UserProfile findByEmail(String email);
}
这里是界面
public interface UserProfileRepositoryCustom {
public List<UserProfile> findAllUsersByEmail(List<String> emails);
}
及其实施
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);
}
当我运行的代码
,我得到的控制器空单。 findByEmail
工作正常。任何人都可以帮助我在这段代码中发生什么错误。
问候,