Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$ab = $this->dm->getDocumentCollection('Document\Test')->createAggregationBuilder();
if (is_array($filter)) {
/* Here $filter is an array which could be $qb->getQuery()->getQuery()['query']
* or manually crafted
* example [ '$and' => [ 'name' => 'keyword'] ]
*/
$ab->match(); // <-- how to pass query array to match stage?
} else {
$ab->match()->text($filter);
}
// more complex things like group, redact, sort are happening and aggregation builder does really well here
$results = $ab->execute();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment