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 in operator to Atlas Search #1605

Merged
merged 16 commits into from
Feb 4, 2025
Merged

Conversation

joykim1005
Copy link
Contributor

@joykim1005 joykim1005 commented Jan 13, 2025

Ticket

JAVA-5744

Description

There are several Atlas Search query operators that are not implemented with first class support in the Java driver. This PR adds the in operator to Atlas Search.

Testing

  • ran ./gradlew check
  • ran atlas-search-test on Evergreen
  • ran SearchOperatorTest
  • ran all Evergreen patch

Sorry, something went wrong.

joykim1005 and others added 3 commits January 13, 2025 11:07
@joykim1005 joykim1005 self-assigned this Jan 14, 2025
@joykim1005 joykim1005 changed the title Add in operator Add in operator to Atlas Search Jan 14, 2025
fix
fix
@joykim1005 joykim1005 requested a review from katcharov January 15, 2025 19:43
@joykim1005 joykim1005 marked this pull request as ready for review January 15, 2025 19:43
@joykim1005
Copy link
Contributor Author

com.mongodb.client.ClientSideEncryptionE…estExternal_withExternalKeyVault__false is failing and is unlikely caused by this PR and is happening in others as well.

joykim1005 and others added 2 commits January 15, 2025 15:38
* @return The requested {@link SearchOperator}.
* @mongodb.atlas.manual atlas-search/in/ in operator
*/
static InSearchOperator in(final FieldSearchPath path, final ObjectId value, final ObjectId... values) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is based on

static DateRangeSearchOperatorBase dateRange(final FieldSearchPath path, final FieldSearchPath... paths)

Having two params ensures that the user is unable to provide zero values. I am not sure we should do this even there, but I think in this case, we should not have both of these params, but just the values, since the docs did not seem to exclude empty lists. (Note that the docs on values seem to be incorrect)

@stIncMale cc

Copy link
Member

@stIncMale stIncMale Jan 16, 2025

Choose a reason for hiding this comment

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

Let's check if the server actually allows passing value: [].

  • If it does not, then following the approach taken in the rest of the search building API, we should introduce in(final FieldSearchPath path, final ObjectId value, final ObjectId... values). We may follow that with adding another thing to be re-reviewed to JAVA-5752: Re-visit some aspects of the Atlas search API design before moving it out of beta
  • If the server indeed allows passing value: [], then we should rather introduce in(final FieldSearchPath path, final ObjectId... values).

Copy link
Collaborator

Choose a reason for hiding this comment

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

@katcharov katcharov requested a review from stIncMale January 24, 2025 20:47
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

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

The last reviewed commit is 65840eb. I did not fully review all commits before it.

katcharov and others added 4 commits January 29, 2025 10:47
…rator.java

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
# Conflicts:
#	driver-core/src/main/com/mongodb/client/model/search/SearchConstructibleBsonElement.java
#	driver-core/src/main/com/mongodb/client/model/search/SearchOperator.java
#	driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesSearchIntegrationTest.java
#	driver-core/src/test/unit/com/mongodb/client/model/search/SearchOperatorTest.java
#	driver-scala/src/main/scala/org/mongodb/scala/model/search/SearchOperator.scala
#	driver-scala/src/main/scala/org/mongodb/scala/model/search/package.scala
@katcharov katcharov requested a review from stIncMale January 29, 2025 21:29
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

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

The last reviewed commit is d0dfa2b.

@jyemin jyemin assigned katcharov and unassigned joykim1005 Jan 30, 2025
…rator.java

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
@katcharov katcharov requested a review from stIncMale February 3, 2025 21:08
@katcharov katcharov merged commit 470fc2e into mongodb:main Feb 4, 2025
60 checks passed
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.

None yet

3 participants