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

PHPORM-283 Add Schema::dropSearchIndex() #3235

Merged
merged 2 commits into from
Jan 3, 2025
Merged

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jan 2, 2025

Fix PHPORM-283

Same helper for both "search" and "vector search" indexes.

Checklist

  • Add tests and ensure they pass

@GromNaN GromNaN requested a review from a team as a code owner January 2, 2025 18:36
@GromNaN GromNaN requested a review from jmikola January 2, 2025 18:36
@GromNaN GromNaN added the feature label Jan 2, 2025
/**
* Drop an Atlas Search or Vector Search index
*/
public function dropSearchIndex(string $name = 'default'): static
Copy link
Member

Choose a reason for hiding this comment

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

I think it's sensible to require an explicit value for $name since this is a destructive operation. It'd be consistent with PHPLIB's existing API.

Copy link
Member Author

Choose a reason for hiding this comment

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

I assumed that if you don't need to specify the name to create or use the default index, it must be the same for deletion. But as a precaution, it can be required. It's now modified.

Copy link
Member

Choose a reason for hiding this comment

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

Requiring explicit values for potentially destructive operations is the same reason the CRUD spec mandates a filter parameter for deletes. More generally, this logic can apply to any write operation (we also wouldn't want to default to an empty filter for an updateMany()).

@GromNaN GromNaN merged commit 223a9f7 into mongodb:5.x Jan 3, 2025
27 checks passed
@GromNaN GromNaN deleted the PHPORM-283 branch January 3, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants