Skip to content

Commit 216841e

Browse files
authored
Merge pull request #2861 from doctrine/2.12.x
Merge 2.12.x into 2.13.x
2 parents c73060e + 2edcd25 commit 216841e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/en/reference/aggregation-stage-reference.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,27 @@ for a reference of all available operators.
711711
->fields('title', 'content')
712712
;
713713
714+
To combine multiple search operators, use the `compound operator <https://www.mongodb.com/docs/atlas/atlas-search/compound/>`_:
715+
716+
.. code-block:: php
717+
718+
<?php
719+
720+
$builder = $dm->createAggregationBuilder(\Documents\Fruits::class);
721+
$builder
722+
->compound()
723+
->must()
724+
->text()->query('varieties')->path('description')
725+
->should(minimumShouldMatch: 1)
726+
->text()->query('Fuji')->path('description')
727+
->text()->query('Golden Delicious')->path('description')
728+
;
729+
730+
This aggregation will return `Fruits` documents from whose `description` field
731+
contains the word "varieties" (must), and should also contain either "Fuji" or
732+
"Golden Delicious" in the `description` field (at least one due to
733+
`minimumShouldMatch: 1`).
734+
714735
$set
715736
----
716737

0 commit comments

Comments
 (0)