Skip to content

JAVA-6236 add builder API for facet without operator#2006

Open
strogiyotec wants to merge 2 commits into
mongodb:mainfrom
strogiyotec:JAVA-6236
Open

JAVA-6236 add builder API for facet without operator#2006
strogiyotec wants to merge 2 commits into
mongodb:mainfrom
strogiyotec:JAVA-6236

Conversation

@strogiyotec

Copy link
Copy Markdown
Contributor

JAVA-6236 add builder API for facet without operator
Existing API marks operator as mandatory but latest facet API makes it optional
https://www.mongodb.com/docs/search/query/operators-collectors/facet/
image

@strogiyotec strogiyotec requested a review from a team as a code owner June 23, 2026 23:37
@strogiyotec strogiyotec requested a review from rozza June 23, 2026 23:37
@codeowners-service-app

Copy link
Copy Markdown

Assigned vbabanin for team dbx-java because rozza is out of office.

@strogiyotec strogiyotec removed the request for review from rozza June 23, 2026 23:43
@dariakp dariakp requested review from stIncMale and removed request for vbabanin June 30, 2026 15:14
* @return The requested {@link SearchCollector}.
* @mongodb.atlas.manual atlas-search/facet/ facet collector
*/
@Beta({Reason.CLIENT, Reason.SERVER})

@stIncMale stIncMale Jul 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like the server had GA of the search functionality in 2020 (see https://www.mongodb.com/docs/atlas/search-changelog/#9-june-2020-release), and there is no information on when specific parts of MQL came out of preview. The DOCSP team said they do not document availability of search operators by DB version.

Since the only information we have, is that currently the collector is not documented as being in preview, we are to interpret it as it not being in preview, despite us not knowing when GA happened. I suspect, the same applies to all the operators, but this has to be checked. We should remove Reason.SERVER here and everywhere in driver-core/src/main/com/mongodb/client/model/search, except for VectorSearchQuery, TextVectorSearchQuery, which are still in preview.

We do not have to do that in this PR, but then, we should do that in the same driver release this PR goes into. Because otherwise it will be very weird to see one of the following:

  • The old SearchCollector.facet method marked as beta because of Reason.SERVER, while the new one not marked the same way.
  • The new SearchCollector.facet method marked as beta because of Reason.SERVER despite the facet collector is not beta anymore.

Comment on lines +57 to +62
/**
* Returns a {@link SearchCollector} that groups results by values or ranges in the specified faceted fields and returns the count
* for each of those groups, faceting over the entire collection.
* <p>
* Unlike {@link #facet(SearchOperator, Iterable)}, this method omits the search operator, so the facets are computed
* across all documents in the collection.</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see two issues with the current wording:

  1. The second sentence (the one after <p>) duplicates part of the first sentence.
  2. The "over the entire collection" / "across all documents in the collection" phrases are not future-proof.

I propose us to change the wording for both the existing and the new facet methods as per stIncMale@d086d43.

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