-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Aggregation query method should be able to return Slice
and Stream
#3645
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
Conversation
…f you pass Pageable and Sort
Hi Mark , |
|
||
List mappedResults = result.getMappedResults(); | ||
|
||
if(method.isPageQuery() || method.isSliceQuery()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a slight difference between Page
and Slice
. Paging is aware of the total amount of items while slice requests pageSize+1
to determine whether there's a next slice available.
Probably paging becomes more difficult because we have to issue a count query and that kind-of imposes performance questions when a complex aggregation is used.
For the time being, let's consider only Slice
and I'm going to raise the issue with our team to discuss the performance aspect when someone wants to use Page<T>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done the changes
Returning a |
Slice
and Stream
Aggregation query methods can not return Slice and Stream. interface PersonRepository extends CrudReppsitory<Person, String> { @Aggregation("{ $group: { _id : $lastname, names : { $addToSet : ?0 } } }") Slice<PersonAggregate> groupByLastnameAnd(String property, Pageable page); @Aggregation("{ $group: { _id : $lastname, names : { $addToSet : $firstname } } }") Stream<PersonAggregate> groupByLastnameAndFirstnamesAsStream(); } Closes #3543. Original pull request: #3645.
Let appendLimitAndOffsetIfPresent accept unary operators for adjusting limit/offset values instead of appendModifiedLimitAndOffsetIfPresent. Apply simple type extraction for Slice. Add support for aggregation result streaming. Extend tests, add author tags, update docs. See #3543. Original pull request: #3645.
Thank you for your contribution. That's merged and polished now. I added also support for |
…f you pass Pageable and Sort