Working with a Spring Boot and Spring data, I have this Mongo Doc:
@Document(collection = "dogs")
public class Dog{
@Id
private long dogId;
private LocalDateTime creationDate;
...
}
I added this method to the Repository:
@Repository
public interface DogRepository extends CrudRepository<Dog, Long>, PagingAndSortingRepository<Dog, Long> {
Page<Dog> findAllByCreationDateAfterAndCreationDateBefore(LocalDateTime createdAfter, LocalDateTime createdBefore, Pageable pageable);
When trying to access the method in run time, I get the following error:
"Due to limitations of the com.mongodb.BasicDocument, you can't add a second 'creationDate' expression specified as 'creationDate : Document{{$lt=2021-05-12T09:42:08.549}}'. Criteria already contains 'creationDate : Document{{$gt=2021-05-12T09:42:07.486}}'."