Skip to content

DATAMONGO-1979 - Add support for @Query(sort = "… #566

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

Closed
wants to merge 3 commits into from

Conversation

christophstrobl
Copy link
Member

We now allow to set a default sort for repository query methods via the @Query annotation.

@Query(sort = "{ age : -1 }")
List<Person> findByFirstname(String firstname);

Using an explicit Sort parameter along with the annotated one allows to alter the defaults set via the annotation. Method argument sort parameters add to / override the annotated defaults.

@Query(sort = "{ age : -1 }")
List<Person> findByFirstname(String firstname, Sort sort);

We now allow to set a default sort for repository query methods via the @query annotation.

	@query(sort = "{ age : -1 }")
	List<Person> findByFirstname(String firstname);

Using an explicit Sort parameter along with the annotated one allows to alter the defaults set via the annotation. Method argument sort parameters add to / override the annotated defaults.

	@query(sort = "{ age : -1 }")
	List<Person> findByFirstname(String firstname, Sort sort);
mp911de added a commit that referenced this pull request Jun 7, 2018
Convert ReactiveMongoRepositoryTests to AssertJ. Add missing verifyComplete() steps to StepVerifier.

Original pull request: #566.
mp911de pushed a commit that referenced this pull request Jun 7, 2018
@query(sort = "…").

We now allow to set a default sort for repository query methods via the @query annotation.

	@query(sort = "{ age : -1 }")
	List<Person> findByFirstname(String firstname);

Using an explicit Sort parameter along with the annotated one allows to alter the defaults set via the annotation. Method argument sort parameters add to / override the annotated defaults.

	@query(sort = "{ age : -1 }")
	List<Person> findByFirstname(String firstname, Sort sort);

Original pull request: #566.
mp911de pushed a commit that referenced this pull request Jun 7, 2018
mp911de added a commit that referenced this pull request Jun 7, 2018
Rename QueryUtils method to decorateSort(…) to reflect the nature of the method. Add missing generics. Convert ReactiveMongoRepositoryTests to AssertJ. Add missing verifyComplete() steps to StepVerifier. Slight tweaks to Javadoc and reference docs.

Original pull request: #566.
@mp911de
Copy link
Member

mp911de commented Jun 7, 2018

That's polished and merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants