Deprecate Stage::search() because the $search stage must be the first of the pipeline#2823
Merged
GromNaN merged 1 commit intodoctrine:2.13.xfrom Sep 14, 2025
Merged
Conversation
Stage::search() because the $search stage must be the first of the pipeline
jmikola
approved these changes
Sep 10, 2025
Member
jmikola
left a comment
There was a problem hiding this comment.
One question just for my understanding, but I assume you know what you're doing here 😄
| * The $search stage performs a full-text search on the specified field or | ||
| * fields which must be covered by an Atlas Search index. | ||
| * | ||
| * @deprecated Since doctrine/mongodb-odm 2.13. This $search stage must be the first of the pipeline, use Builder::search() instead. |
Member
There was a problem hiding this comment.
I realize this is ODM and not PHPLIB's builder, but is there not a use case for creating your own pipeline with a list of Stage objects where it might still make sense to use a $search Stage?
Member
Author
There was a problem hiding this comment.
The Builder is a required dependency of the Stage classes. You cannot create stages without builder. Calling ->search from an existing stage means that you append the search stage after the current stage, which is never allowed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
And mentioned in the ODM doc:
mongodb-odm/docs/en/reference/aggregation-stage-reference.rst
Lines 679 to 685 in e3352c0