Using a ReactiveMongoRepository and a custom method to return all objects with the matching property is returning a empty collection on anything other than the findAllById call.
I'm wondering if I just misunderstood something here and this only works on the ID field or something?
The interface I'm using:
@Repository
public interface VideoRepository extends ReactiveMongoRepository<Video, String> {
Flux<Video> findAllByHash(Iterable<Long> hash);
}
And I'm just calling that via:
@GetMapping("duplicates")
public Flux<Video> duplicates() {
// {...}
List<Long> hashList = duplicateDTOs
.stream()
.map(duplicateDTO -> Long.valueOf(duplicateDTO.getHash()))
.collect(Collectors.toList());
return videoRepository.findAllByHash(hashList);
}
For reference, the POJO in question:
@Data
@Builder
@Document
@AllArgsConstructor
@NoArgsConstructor
public class Video {
@Id
String id;
long hash;
//{...}
}
I have confirmed I'm passing in three values in the hashList which match the custom hash property set on the Video POJO.
Should this not return all Video objects which have the matching custom hash property as it does when I do the same thing but for the id property?