Skip to content

Commit 2a9118a

Browse files
authored
Deprecate Stage::search() because the $search stage must be the first of the pipeline (#2823)
1 parent ace0396 commit 2a9118a

File tree

1 file changed

+4
-0
lines changed
  • lib/Doctrine/ODM/MongoDB/Aggregation

1 file changed

+4
-0
lines changed

lib/Doctrine/ODM/MongoDB/Aggregation/Stage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,14 @@ public function sample(int $size): Stage\Sample
368368
* The $search stage performs a full-text search on the specified field or
369369
* fields which must be covered by an Atlas Search index.
370370
*
371+
* @deprecated Since doctrine/mongodb-odm 2.13. This $search stage must be the first of the pipeline, use Builder::search() instead.
372+
*
371373
* @see https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#mongodb-pipeline-pipe.-search
372374
*/
373375
public function search(): Stage\Search
374376
{
377+
trigger_deprecation('doctrine/mongodb-odm', '2.13', 'Using "%s" is deprecated because the $search stage must be the first of the pipeline, use "%s::search()" instead.', __METHOD__, Builder::class);
378+
375379
return $this->builder->search();
376380
}
377381

0 commit comments

Comments
 (0)