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

Add support for $median aggregation expression #4515

Closed
wants to merge 3 commits into from
Closed

Conversation

sxhinzvc
Copy link
Contributor

No description provided.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 26, 2023
@sxhinzvc sxhinzvc marked this pull request as ready for review September 26, 2023 17:42
Comment on lines 35 to 36
import org.springframework.data.mongodb.core.aggregation.SetWindowFieldsOperation.WindowUnit;
import org.springframework.data.mongodb.core.aggregation.SetWindowFieldsOperation.WindowUnits;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a duplicate of L33:34

assertThat(valueOf("scoreOne").median().and(Sum.sumOf("scoreTwo")).toDocument(Aggregation.DEFAULT_CONTEXT))
.isEqualTo(Document.parse("{ $median: { input: [\"$scoreOne\", {\"$sum\": \"$scoreTwo\"}], method: \"approximate\" } }"));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add one more test using a TypeBasedAggregationOperationContext?
something like:

assertThat(valueOf("midichlorianCount").median().toDocument(contextFor(Jedi.class)))
    .isEqualTo("{ $median: { input: '$force', ...

Add $median to documentation. Add test to ensure adherence to TypedAggregationContext. Remove duplicate imports.

See #4472
Original Pull Request: #4515
christophstrobl pushed a commit that referenced this pull request Sep 28, 2023
christophstrobl added a commit that referenced this pull request Sep 28, 2023
@christophstrobl christophstrobl deleted the issue/4472 branch September 28, 2023 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants