JAVA-6202 - #2023
Conversation
There was a problem hiding this comment.
Pull request overview
Adds fluent builder support for the aggregation $score stage (MongoDB 8.2+) to driver-core, with corresponding Scala wrapper exposure and rendering/functional test coverage.
Changes:
- Introduces
ScoreOptions,ScoreNormalization, and an internalScoreConstructibleBsonto model$scorestage options. - Adds
Aggregates.score(...)overloads indriver-coreanddriver-scala. - Adds Java functional tests and Scala model rendering specs for
$score.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| driver-scala/src/test/scala/org/mongodb/scala/model/AggregatesSpec.scala | Adds Scala rendering assertions for $score with and without options. |
| driver-scala/src/main/scala/org/mongodb/scala/model/package.scala | Exposes ScoreOptions / ScoreNormalization type aliases in the Scala model package. |
| driver-scala/src/main/scala/org/mongodb/scala/model/Aggregates.scala | Adds Scala Aggregates.score overloads delegating to Java core builders. |
| driver-core/src/test/functional/com/mongodb/client/model/AggregatesTest.java | Adds pipeline rendering tests plus a server-gated functional test verifying computed score behavior. |
| driver-core/src/main/com/mongodb/client/model/ScoreOptions.java | Introduces the public options interface for $score. |
| driver-core/src/main/com/mongodb/client/model/ScoreNormalization.java | Adds the normalization enum and server string mappings. |
| driver-core/src/main/com/mongodb/client/model/ScoreConstructibleBson.java | Implements ScoreOptions using the existing constructible-BSON pattern. |
| driver-core/src/main/com/mongodb/client/model/Aggregates.java | Adds core $score stage builders and BSON encoding logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rozza
left a comment
There was a problem hiding this comment.
Its looking good - have a couple of nits.
| } | ||
|
|
||
| @Test | ||
| public void testScoreWithAllOptions() { |
There was a problem hiding this comment.
Request: Adding tests for all normalization types to protect against accidential regressions.
There was a problem hiding this comment.
Added two test cases that inject all enum values
Temporarily duplicates the ScoreNormalization enum from PR mongodb#2023 so both branches compile independently; once JAVA-6202 merges, the duplicate is dropped in favor of theirs.
|
Two small doc requests on
|
JAVA-6202 Fluent API for $score
The core builder API was written by claude, I just verified that it follows the code practices used in other builders and ran the tests locally