Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds failing unit-test for issue #4839 NPE when projecting to an inte… #4840

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,11 @@ void readsClosedProjection() {
assertThat(repository.findClosedProjectionBy()).isNotEmpty();
}

@Test // https://github.com/spring-projects/spring-data-mongodb/issues/4839
void findAggregatedClosedProjectionBy() {
assertThat(repository.findAggregatedClosedProjectionBy()).isNotEmpty();
}

@Test // DATAMONGO-1865
void findFirstEntityReturnsFirstResultEvenForNonUniqueMatches() {
assertThat(repository.findFirstBy()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ Page<Person> findByCustomQueryLastnameAndAddressStreetInList(String lastname, Li
// DATAMONGO-1752
Iterable<PersonSummary> findClosedProjectionBy();

// https://github.com/spring-projects/spring-data-mongodb/issues/4839
@Aggregation("{ '$project': { _id : 0, firstName : 1, lastname : 1 } }")
Iterable<PersonSummary> findAggregatedClosedProjectionBy();

@Query(sort = "{ age : -1 }")
List<Person> findByAgeGreaterThan(int age);

Expand Down